Save userform values in excel sheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

HI,

I'm new to the userforms. I've created on with a combobox and a textbox. In
the same workbook I have a sheet called "Results". When a user clicks "OK" I
want the selected values to populate the results worksheet. It works fine
with the code below:

Worksheets("Results").Range("$B2") = UserForm.ComboBox1.Value
Worksheets("Results").Range("$A2") = UserForm.TextBox1.Value

However, I want it to go to the next cell each time (B3,B4,B5 etc). Now it's
just overwriting the A2 & B2 Valueas.

Thanks!
 
Lastrow = Worksheets("Results").cells(rows.count,"A").end(xlup).Row

Worksheets("Results").Range("$B" & (Lastrow + 1)) = _
UserForm.ComboBox1.Value
Worksheets("Results").Range("$A" & (LastRow + 1)) = _
UserForm.TextBox1.Value
 
Joel, apologies for my late reply. This solves my problem perfectly, thanks!
 

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