How do I set values from a userform

  • Thread starter Thread starter Newbie
  • Start date Start date
N

Newbie

I have a userform with three controls.

I would like the entries in these controls to be placed in the next blank
row of a worksheet on the click on the ok button.

Q1, How do I find the next blank row in the list
Q2. How do I copy the values from the userform to the row found in Q1

Thanks
 
Newbie said:
I have a userform with three controls.

I would like the entries in these controls to be placed in the next blank
row of a worksheet on the click on the ok button.

Q1, How do I find the next blank row in the list
Q2. How do I copy the values from the userform to the row found in Q1

Supposing the list starts in A1 of the first sheet, the three textboxs
are Textbox1, Textbox2, Textbox3 and the button is named cmdOK:

Private Sub cmdOK_Click()
Dim FirstBlankCell As Range

'Answer to Q1
Set FirstBlankCell = Sheets(1).Range("B6").End(xlDown).Offset(1, 0)

'Answer to Q2
FirstBlankCell.Offset(0,0) = Textbox1
FirstBlankCell.Offset(0,1) = Textbox2
FirstBlankCell.Offset(0,2) = Textbox3
End Sub

Regards,
 
Back
Top