Thread: numbering macro
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.newusers
Gary''s Student
 
Posts: n/a
Default numbering macro

Try:

Sub Macro1()
Dim i As Integer
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
i = 1
For j = 3 To 100
If IsEmpty(Cells(j, 2)) Then
Else
Cells(j, 1) = i
i = i + 1
End If
Next
End Sub
--
Gary's Student


"Maasha" wrote:

In a database of say 10 columns and 100 rows, how do I record a macro
that will



o Insert a new column to the left of column A, then

o in the new column A, number the rows that contain data in
column B.



Note: The numbering should start from 1. Since row 1 has the database
heading & row 2 has the column headings, the numbering (no. 1) should
start from row 3 and continue down to the last row that has data in
column B.