Here's one way: (In a standard module)
Sub Foo()
Range("B2").Select
lrow = Cells(Rows.Count, 2).End(xlUp).Row
Set myrange = Range(Cells(2, 2), Cells(lrow, 2))
For Each cell In myrange
cell.Offset(0, -1).Value = i + 1
i = i + 1
Next cell
End Sub
"LoveCandle" wrote
in message ...
Hi all,
I use the following formula to get an Auto Serial Number for all cells
in column A.
Code:
--------------------
=IF(B2<"",ROW()-1,"")
--------------------
My question is how can I get an Auto Serial Number for all cells in
column A by using VBA.
I hope that my quesion is clear,
Thank you,
--
LoveCandle
------------------------------------------------------------------------
LoveCandle's Profile:
http://www.excelforum.com/member.php...o&userid=28612
View this thread: http://www.excelforum.com/showthread...hreadid=487565