ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I set values from a userform (https://www.excelbanter.com/excel-programming/291060-how-do-i-set-values-userform.html)

Newbie

How do I set values from a userform
 
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



Beto[_3_]

How do I set values from a userform
 
Newbie wrote:

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,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.



All times are GMT +1. The time now is 02:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com