Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Save userform values in excel sheet

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Save userform values in excel sheet

Lastrow = Worksheets("Results").cells(rows.count,"A").end(xl up).Row

Worksheets("Results").Range("$B" & (Lastrow + 1)) = _
UserForm.ComboBox1.Value
Worksheets("Results").Range("$A" & (LastRow + 1)) = _
UserForm.TextBox1.Value


"Hendrik" wrote:

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!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Save userform values in excel sheet

Joel, apologies for my late reply. This solves my problem perfectly, thanks!

"Joel" wrote:

Lastrow = Worksheets("Results").cells(rows.count,"A").end(xl up).Row

Worksheets("Results").Range("$B" & (Lastrow + 1)) = _
UserForm.ComboBox1.Value
Worksheets("Results").Range("$A" & (LastRow + 1)) = _
UserForm.TextBox1.Value


"Hendrik" wrote:

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!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Values into Excel sheet [email protected] Excel Programming 1 February 21st 07 07:57 PM
Userform Values into Excel sheet [email protected] Excel Programming 2 February 21st 07 07:49 PM
Insert UserForm Values into Excel sheet Aravind[_3_] Excel Programming 1 February 21st 07 07:31 PM
macro to save a values of a cell in a new sheet as a new row dpt Excel Programming 8 August 8th 05 07:41 AM
Save only values of one sheet Anja Excel Discussion (Misc queries) 1 March 10th 05 09:51 AM


All times are GMT +1. The time now is 06:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"