How to increment number using vb script
Dave:
This work on both, thanks a lots. what is ROW()-1 means?
Lillian
"Dave Peterson" wrote:
Do you really need a macro:
Put something like this in A1 and copy down:
=TEXT((ROW()-1)*2,"000")&"002"
As a macro:
Option Explicit
Sub testme()
With ActiveSheet.Range("a1:a500")
.NumberFormat = "General"
.Formula = "=TEXT((ROW()-1)*2,""000"")&""002"""
.NumberFormat = "@"
.Value = .Value
End With
End Sub
Lillian wrote:
I have one excel spreed sheet on columnA one row A1 has "000002", on the 3rd
charactor I need to change to 2 for second row as "002002", then third row
will be as "004002", I need to increment 2 from the previous row until to the
end of row as"998002", how to run with the macro.
000002
002002
004002
006002
..........
998002
Thank you so much.
--
Dave Peterson
|