Fill column from 1 to n based on value

vaemps

New Member
Joined
Apr 13, 2021
Messages
6
Office Version
  1. 2019
Platform
  1. Windows
I want to create a script that will fill column cells from 1 to n, which is a value in textbox.

So far I can find the next empty cell in a column, but I can't fill from this cell to below up to n.

dim ws as worksheet
dim i as integer
set ws = Sheets(Sheet1)

For i = 1 to TB_QTY.Value

ws.Range("F100").End(xlUp).Offset(1, 0).Value = i

next i

I know this is not correct, since i cannot be used as a value, but I cannot think any way to solve this. I guess it should be quite easy, but I cannot google my way out of this one, since I am not sure what script I am looking for.

Any help would be appreciated!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
You are missing the quotes on your sheet name, it should be
VBA Code:
Set ws = Sheets("Sheet1")
 
Upvote 0

Forum statistics

Threads
1,214,980
Messages
6,122,563
Members
449,088
Latest member
Motoracer88

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