How can I auto number rows only when data is entered in the same r

  • Thread starter Thread starter Plateav
  • Start date Start date
P

Plateav

I'm working with Microsoft Office 2003. Is there anyway I can auto number
rows (in sequence) in column A ONLY when data is entered in column B? 9 cool
points for the first correct answer. THANKS! (0:
 
Using a formula:

=IF(B2="","",A1+1)
copied down as far as you would ever need to go.

Using VB:
Right click on sheet tab, view code, paste this in:

'=======
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
Target.Offset(0, -1).Value = Target.Offset(-1, -1).Value + 1
End Sub
'=======
 
You could use a formula in column A that makes it look like an empty row until
something appears in column B. But you'll have to copy it down the column as
far as you need:

=if(b1="","",row())

(This assumes that no rows in column B are skipped.)
 
Back
Top