blank cell, loop issues

bradgar

Board Regular
Joined
Aug 29, 2011
Messages
78
Hi there,

Thanks in advance for any help! This is all using VBA..

I am trying to have a userform automate some work I have to manually enter each time. I have column A self populate according to column B. With column B I am stuck though. In the userform I have a textbox to collect how many rows are to be populated.

I need column B to find the first blank cell in the column, then loop according to the input from the user form. For example if they input the number 10, then this macro will fill the next ten blank cells in column B.

any ideas?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try something like

Code:
Range("B" & Rows.Count).End(xlUp).Offset(1).Resize(Val(TextBox1.Value)).Value = whatever
 
Upvote 0
VoG Thank you so much, this worked PERFECTLY!! I cannot thank you enough, been stumped for hours.

I am curious though what the .resize(val.... is for/does?

thanks again!
 
Upvote 0
The resize resizes the first blank cell to x rows deep where x is the value in your textbox. The Val() may be unnecessary like

Code:
Range("B" & Rows.Count).End(xlUp).Offset(1).Resize(TextBox1.Value).Value = whatever
but I didn't test that.

P.S. In the VBE, if you click in a keyword like Resize then press F1 the help on that keyword will be displayed.
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,916
Members
452,949
Latest member
beartooth91

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