View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
jfcby[_2_] jfcby[_2_] is offline
external usenet poster
 
Posts: 121
Default Number Cells, Excel 2000 & 2003

Hello Mike,

Your code worked great!

The only thing was it put a number in column 1 cell if column 2 cell
was empty. I needed it to put a number in column 1 cell if column 2
cell had data in it.

So I modified the code this way:

Sub mersible2()
'This code will put sequential numbers in column 1 if column 2 has
data

x = 1
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
End With
Set myRange = Range("A4:A" & LastRow) '<< Changed to start with
Range("A4:A")
myRange.Select
For Each C In myRange
C.Select
If ActiveCell.Offset(0, 1).Value "" Then '<< Cahnged = to
ActiveCell.Value = x
x = x + 1
End If
Next
End Sub

Thank you your quick response and help,
jfcby