i've got a sample database (attached) with a userform for inputting of data. What i want it to do is automatically generate the next number and add it to textbox "our ref" on the userform. the number is in Col C. This is the code i've tried using the code highlighted in red which doesnt work..... can you point me in the right direction ?
i've attached said file...
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
Worksheets("DATA").Select
Range("A2").Select
Do Until ActiveCell.Value = ""
UserForm1.ComboBox1.AddItem ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Loop
Worksheets("DATA").Select
Range("B2").Select
Do Until ActiveCell.Value = ""
UserForm1.ComboBox2.AddItem ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Loop
Worksheets("DATA").Select
Range("c2").Select
Do Until ActiveCell.Value = ""
UserForm1.ComboBox3.AddItem ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Loop
Worksheets("RESULTS").Select
Range("C1").Select
nextNumber = Sheets("RESULTS").Range("C1").Value + 1
UserForm1.TextBox3.AddItem nextNumber.Value
Loop
Worksheets("Results").Select
End Sub
Bookmarks