Creating a Number Sequence based on a for loop.

TheStobi

New Member
Joined
Aug 1, 2014
Messages
2
Hello Everyone,
I am a Newby to Excel VBA and as such, not competent at all. :) I am trying to create a number counter which runs up to a value which is determined by a COUNTIF Statement in the spreadsheet. I can get the number counter to run to the given value. However, due do formatting reasons I do not want the counter to start in cell A1 but A3 instead. Any Ideas on how I could solve this issue? Thanks a lot in advance!!!Hello Everyone,
I am a Newby to Excel VBA and as such, not competent at all. :) I am trying to create a number counter which runs up to a value which is determined by a COUNTIF Statement in the spreadsheet. I can get the number counter to run to the given value. However, due do formatting reasons I do not want the counter to start in cell A1 but A3 instead. Any Ideas on how I could solve this issue? Thanks a lot in advance!!! Essentially my code looks like this:

...
ActiveSheet.Cells(3, 1).Select


Dim i As Integer

For i = 1 To Range("A1")
Cells(i, 1) = i
Next i
...
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Welcome to the board.

I'm not sure I fully understand, but try running this and see if it's what you're looking for:

Code:
Sub CountIt()

Dim i as Integer

For i = 1 to Range("A1").Value
Range("A" & i).Offset(2,0) = i
Next i

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,475
Messages
6,125,028
Members
449,205
Latest member
Eggy66

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