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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top