Hello I am looking for a way to populate column B onwards when "number" in the userform matches with column A. I can populate data in the next blank row but want to put say number 92 in and then have all columns for number 92 populate with the info I have put into the userform.
Private Sub CommandButton1_Click()
Dim emptyRow As Long
Sheet1.Activate
emptyRow = WorksheetFunction.CountA(Range("B:B")) + 3
Cells(emptyRow, 2).Value = Firstname.Value
Cells(emptyRow, 3).Value = Surname.Value
Cells(emptyRow, 4).Value = TextBox10.Value
Cells(emptyRow, 5).Value = TextBox11.Value
Cells(emptyRow, 6).Value = TextBox12.Value
Cells(emptyRow, 7).Value = Address.Value
Cells(emptyRow, 8).Value = Suburb.Value
Cells(emptyRow, 9).Value = Postcode.Value
Cells(emptyRow, 10).Value = Phone.Value
Cells(emptyRow, 11).Value = Mobile.Value
If LifeMemberBox1.Value = True Then Cells(emptyRow, 12).Value = Label20.Caption
Firstname.Value = ""
Surname.Value = ""
TextBox10.Value = ""
TextBox11.Value = ""
TextBox12.Value = ""
Address.Value = ""
Suburb.Value = ""
Postcode.Value = ""
Phone.Value = ""
Mobile.Value = ""
Firstname.SetFocus
End With
End Sub
Thanks in advance for any help.
Private Sub CommandButton1_Click()
Dim emptyRow As Long
Sheet1.Activate
emptyRow = WorksheetFunction.CountA(Range("B:B")) + 3
Cells(emptyRow, 2).Value = Firstname.Value
Cells(emptyRow, 3).Value = Surname.Value
Cells(emptyRow, 4).Value = TextBox10.Value
Cells(emptyRow, 5).Value = TextBox11.Value
Cells(emptyRow, 6).Value = TextBox12.Value
Cells(emptyRow, 7).Value = Address.Value
Cells(emptyRow, 8).Value = Suburb.Value
Cells(emptyRow, 9).Value = Postcode.Value
Cells(emptyRow, 10).Value = Phone.Value
Cells(emptyRow, 11).Value = Mobile.Value
If LifeMemberBox1.Value = True Then Cells(emptyRow, 12).Value = Label20.Caption
Firstname.Value = ""
Surname.Value = ""
TextBox10.Value = ""
TextBox11.Value = ""
TextBox12.Value = ""
Address.Value = ""
Suburb.Value = ""
Postcode.Value = ""
Phone.Value = ""
Mobile.Value = ""
Firstname.SetFocus
End With
End Sub
Thanks in advance for any help.
Last edited: