Userform - Looking up number then adding data

Thurton

New Member
Joined
Mar 30, 2014
Messages
1
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.
 
Last edited:

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top