I have a column of an undefined number of rows where I need to add item numbers from 1 to however many items there are, starting from A9 downwards.
The last 3 used rows on the sheet contain signatures etc so it should not number the bottom 3 rows.
pretty sure its fairly simple code but i dont have anything similar from previous files that i can re-use to do this :p
just needs a simple
count how many rows are blank from A9 downwards (to say A200)
for num=1 to count do
Cell range(A(9+num) = num
end
i just dont know the code well enough to write it and make it work :p
Last edited by neowok; 10-01-2009 at 11:33 AM.
ok i managed to do it :D
Dim lastrow
lastrow = ActiveSheet.UsedRange.Rows.Count - 11
For Count = 1 To lastrow
Cells(7 + Count, 1).Value = Count
Next Count
neowok
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
Check out the free Excel Toolbar
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Code Tags: Make your code easier for us to read
Hi, This will sequentially number column "A" from "A9" to the row three from the Bottom of Column "A" Data.
Regards MickCode:Sub MG01Oct10 Dim Last As Integer Last = Range("A" & Rows.Count).End(xlUp).row - 3 With Range("A9") .Value = 1 .AutoFill Destination:=Range("A9:A" & Last), Type:=xlFillSeries End With End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks