Quick and probably easy question.

SuperSean

New Member
Joined
Apr 30, 2002
Messages
45
Heya gang,

I know I've surpassed my newbie questions for the day but maybe you could help with this real quick.

Got a user form (from Mr.Excell's example in the tips of the week from long ago, this is the "OK" button.)

See where it says Range("A2")?
Is there any way to put a variable in there that'll let the info be printed on the next available line?

Private Sub CommandButton1_Click()
Worksheets("Sheet3").Range("A2") = UserForm1.ComboBox1.Value
UserForm1.Hide
End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Thanks a bunch!

I have one question left about this though.
I'm just trying to figure out what I'm telling excell.

Worksheets("Sheet3").[a65536].End(xlUp) = UserForm1.ComboBox1.Value

[a65536] - What's this and where did it come from????

I understand the rest, thanks for the help!
 
Upvote 0
Hrmnnn,

Seems I answered my own question here. The a65536 is a cell reference way way down at the bottom of the sheet, then with end(xlup) we go to the nearest available line (from bottom) my problem now is that it replaces the text in that row instead of moving down one each time. What I need is for data to appear in A2 the first time I choose, A3 the second time ect..

Any ideas?
 
Upvote 0
Try going from the current line DOWN. Should be much faster than starting at the bottom and going up.

Worksheets("Sheet3").[A1].End(xlDown) = UserForm1.ComboBox1.Value
'move to the next cell
Activecell.offsett(1,0).select

'continue from here
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,513
Members
448,967
Latest member
screechyboy79

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top