I have a userform and i need to make sure that when the user presses the add client button, it only adds the info from the userform to the sheet if all fields are filled.
The code that i have at the minute doesnt allow you to proceed if a phone number has been added but i dont know how to make it work for multiple fields.
Private Sub add_Click()
If phonetxt.Value = "" Then
MsgBox "Please enter a Phone Number"
Exit Sub
Else
Dim FirstBlankRow As Long
FirstBlankRow = Cells(Rows.Count, "M").End(xlUp)(2).Row
Sheets("List").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) = Me.departmenttxt.Value
Sheets("List").Range("B" & Rows.Count).End(xlUp).Offset(1, 0) = Me.firsttxt.Value
Sheets("List").Range("C" & Rows.Count).End(xlUp).Offset(1, 0) = Me.lasttxt.Value
Sheets("List").Range("D" & Rows.Count).End(xlUp).Offset(1, 0) = Me.emailtxt.Value
Sheets("List").Range("E" & Rows.Count).End(xlUp).Offset(1, 0) = Me.phonetxt.Value
Sheets("List").Range("F" & Rows.Count).End(xlUp).Offset(1, 0) = Me.notxt.Value
Sheets("List").Range("G" & Rows.Count).End(xlUp).Offset(1, 0) = Me.daytxt.Value
Sheets("List").Range("H" & Rows.Count).End(xlUp).Offset(1, 0) = Me.monthtxt.Value
Sheets("List").Range("I" & Rows.Count).End(xlUp).Offset(1, 0) = Me.yeartxt.Value
Sheets("List").Range("J" & Rows.Count).End(xlUp).Offset(1, 0) = Me.timeslottxt.Value
Sheets("List").Range("L" & Rows.Count).End(xlUp).Offset(1, 0) = Me.nowtxt.Value
Sheets("List").Range("M" & Rows.Count).End(xlUp).Offset(1, 0) = Me.timetxt.Value
Sheets("List").Range("K" & Rows.Count).End(xlUp).Offset(1, 0) = notesform.notetxt.Value
Sheets("List").Range("N" & Rows.Count).End(xlUp).Offset(1, 0) = vipbtn.Value
Sheets("List").Range("O" & Rows.Count).End(xlUp).Offset(1, 0) = monobtn.Value
Sheets("List").Range("P" & Rows.Count).End(xlUp).Offset(1, 0) = bookedbox.Value
End If
Unload Me
home.Show
Unload notesform
End Sub
Any help will be greatly appreciated
Bookmarks