filmov
tv
Excel VBA Bangla Tutorial 59 : Multi Pages Data Entry form in Excel and Employee Database | Part- 1

Показать описание
#HasanAcademy #ExcelBanglaTutorial #VbaBanglaTutorial
To create a multi-page data entry form in Excel with VBA, you can use a Userform with multiple pages. Here is an example of how to create a three-page data entry form in Excel:
Open a new Excel workbook and press "Alt + F11" to open the Visual Basic Editor.
In the Project Explorer, right-click on the "VBAProject" and choose "Insert" -"Userform".
Double-click on the new Userform to open the code window.
Add a "Multipage" control to the Userform by going to the "Toolbox" and selecting the "Multipage" control.
Adjust the size and position of the Multipage control to fit the Userform.
Right-click on the Multipage control and choose "Add Page" to create a new page.
Repeat step 6 to create a total of three pages.
On each page, add labels and textboxes for the data you want to collect.
Add a "Next" button to the first page and a "Previous" and "Submit" button to the last page.
Double-click on the "Next" button to open the code window.
Add the following code to the "Next" button to move to the next page:
VBA
Copy code
Private Sub NextButton_Click()
Multipage1.Value = Multipage1.Value + 1
End Sub
Double-click on the "Previous" button to open the code window.
Add the following code to the "Previous" button to move to the previous page:
VBA
Copy code
Private Sub PreviousButton_Click()
Multipage1.Value = Multipage1.Value - 1
End Sub
Double-click on the "Submit" button to open the code window.
Add the following code to the "Submit" button to save the data to a worksheet:
VBA
Copy code
Private Sub SubmitButton_Click()
'Assuming the data in the Userform is stored in textboxes with names like "NameTextbox", "AddressTextbox", etc.
'Assuming the data should be saved in a worksheet named "EmployeeDatabase" in columns A to D, starting in row 2.
With ThisWorkbook.Worksheets("EmployeeDatabase")
.Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).Value = NameTextbox.Value
.Cells(.Rows.Count, 2).End(xlUp).Offset(1, 0).Value = AddressTextbox.Value
.Cells(.Rows.Count, 3).End(xlUp).Offset(1, 0).Value = PhoneNumberTextbox.Value
.Cells(.Rows.Count, 4).End(xlUp).Offset(1, 0).Value = EmailTextbox.Value
End With
'Clear the Userform
NameTextbox.Value = ""
AddressTextbox.Value = ""
PhoneNumberTextbox.Value = ""
EmailTextbox.Value = ""
'Return to the first page
Multipage1.Value = 0
End Sub
Save the Userform and close the Visual Basic Editor.
Now, when you run the Userform, you will have a three-page data entry form with a "Next" button to move to the next page, a "Previous" button to move to the previous page, and a "Submit" button to save the data to a worksheet named "EmployeeDatabase" in columns A to D, starting in row 2. You can modify the code to fit your specific data entry form and worksheet structure.
Multiple Userform part-1
Multiple Userform part-2
Multiple Userform part-3
Multiple Userform part-4
Most of the people is think about that how I will learn .But they didn't get any idea & trustworthy source. Don't hesitated Hasan Academy with you. You will learn from here, Excel, Excel Chart, Pivot Table, Vlookup, Formula function
To create a multi-page data entry form in Excel with VBA, you can use a Userform with multiple pages. Here is an example of how to create a three-page data entry form in Excel:
Open a new Excel workbook and press "Alt + F11" to open the Visual Basic Editor.
In the Project Explorer, right-click on the "VBAProject" and choose "Insert" -"Userform".
Double-click on the new Userform to open the code window.
Add a "Multipage" control to the Userform by going to the "Toolbox" and selecting the "Multipage" control.
Adjust the size and position of the Multipage control to fit the Userform.
Right-click on the Multipage control and choose "Add Page" to create a new page.
Repeat step 6 to create a total of three pages.
On each page, add labels and textboxes for the data you want to collect.
Add a "Next" button to the first page and a "Previous" and "Submit" button to the last page.
Double-click on the "Next" button to open the code window.
Add the following code to the "Next" button to move to the next page:
VBA
Copy code
Private Sub NextButton_Click()
Multipage1.Value = Multipage1.Value + 1
End Sub
Double-click on the "Previous" button to open the code window.
Add the following code to the "Previous" button to move to the previous page:
VBA
Copy code
Private Sub PreviousButton_Click()
Multipage1.Value = Multipage1.Value - 1
End Sub
Double-click on the "Submit" button to open the code window.
Add the following code to the "Submit" button to save the data to a worksheet:
VBA
Copy code
Private Sub SubmitButton_Click()
'Assuming the data in the Userform is stored in textboxes with names like "NameTextbox", "AddressTextbox", etc.
'Assuming the data should be saved in a worksheet named "EmployeeDatabase" in columns A to D, starting in row 2.
With ThisWorkbook.Worksheets("EmployeeDatabase")
.Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).Value = NameTextbox.Value
.Cells(.Rows.Count, 2).End(xlUp).Offset(1, 0).Value = AddressTextbox.Value
.Cells(.Rows.Count, 3).End(xlUp).Offset(1, 0).Value = PhoneNumberTextbox.Value
.Cells(.Rows.Count, 4).End(xlUp).Offset(1, 0).Value = EmailTextbox.Value
End With
'Clear the Userform
NameTextbox.Value = ""
AddressTextbox.Value = ""
PhoneNumberTextbox.Value = ""
EmailTextbox.Value = ""
'Return to the first page
Multipage1.Value = 0
End Sub
Save the Userform and close the Visual Basic Editor.
Now, when you run the Userform, you will have a three-page data entry form with a "Next" button to move to the next page, a "Previous" button to move to the previous page, and a "Submit" button to save the data to a worksheet named "EmployeeDatabase" in columns A to D, starting in row 2. You can modify the code to fit your specific data entry form and worksheet structure.
Multiple Userform part-1
Multiple Userform part-2
Multiple Userform part-3
Multiple Userform part-4
Most of the people is think about that how I will learn .But they didn't get any idea & trustworthy source. Don't hesitated Hasan Academy with you. You will learn from here, Excel, Excel Chart, Pivot Table, Vlookup, Formula function
Комментарии