944,360 views 206 on YTPak
1,289 162

Published on 15 Apr 2012 | over 5 years ago

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
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 = ""
Customize Your Hybrid Embed Video Player!

6-digit hexadecimal color code without # symbol.


Report video function is under development.


Loading related videos...