How to: Create a simple Userform in Excel
My first tutorial showing how to create a simple user form using excel. Thanks for watching.
The code needed for the "add details" button:
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
'find first empty row in database
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'check for a Name number
If Trim(Me.textbox_name.Value) = "" Then
Me.textbox_Name.SetFocus
MsgBox "Please complete the form"
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.textbox_name.Value
ws.Cells(iRow, 2).Value = Me.textbox_surname.Value
ws.Cells(iRow, 3).Value = Me.textbox_age.Value
ws.Cells(iRow, 4).Value = Me.textbox_gender.Value
MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
Me.textbox_name.Value = ""
Me.textbox_surname.Value = ""
Me.textbox_age.Value = ""
Me.textbox_gender.Value = ""
Me.textbox_name.SetFocus
Видео How to: Create a simple Userform in Excel канала SPTutorials1
The code needed for the "add details" button:
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
'find first empty row in database
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'check for a Name number
If Trim(Me.textbox_name.Value) = "" Then
Me.textbox_Name.SetFocus
MsgBox "Please complete the form"
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.textbox_name.Value
ws.Cells(iRow, 2).Value = Me.textbox_surname.Value
ws.Cells(iRow, 3).Value = Me.textbox_age.Value
ws.Cells(iRow, 4).Value = Me.textbox_gender.Value
MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
Me.textbox_name.Value = ""
Me.textbox_surname.Value = ""
Me.textbox_age.Value = ""
Me.textbox_gender.Value = ""
Me.textbox_name.SetFocus
Видео How to: Create a simple Userform in Excel канала SPTutorials1
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
Fully Automated Data Entry User Form in Excel - Step By Step TutorialHow to Create & Use Excel Macros (Real world example)Create Userform in Excel VBA Macro in DetailCreating Easy Data Entry Forms in ExcelExcel #32: Utiliser les Macros pour automatiser les tâches. Créer un formulaire de saisie.Create User-Forms with Navigation ButtonsCreate a searchable drop down list in ExcelExcel Visual Basic (VBA) for Beginners - Part 1 of 4: Buttons and MacrosExcel VBA USERFORMS #20 Data Entry a Breeze with Userforms! AUTOCOMPLETE with ComboboxUserform in Excel in Hindi - Data Add | Search | Update | DeleteHow to make Macro enabled Form in Excel Sheet?SUPER EASY Excel Data Entry Form (NO VBA)Excel Macro Class 1 - Getting Started Programming MacrosExcel VBA Beginner TutorialConvert Excel File Into exeCreate An Excel Data Entry Form With UserForm - Add, Update, Delete and SaveHow To Create An Excel Data Entry Form With A UserForm - Full TutorialExcel VBA Userform : Atelier UserformConsolidate & Clean Multiple Excel Sheets in One Pivot TableTutorial Membuat Entri Data Form di Excel