Thread: Row number
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Robin Hammond Robin Hammond is offline
external usenet poster
 
Posts: 79
Default Row number

Gareth,

as a general hint, if you dimension things first, you will find it easier to
see properties and methods. I've also added an escape hatch to this so you
don't get 1000 message boxes in the event of an empty column.

Sub Test()
Dim rngCell As Range
For Each rngCell In Range("F2:F1001")
If IsEmpty(rngCell.Value) Then
MsgBox " Please check row " & rngCell.Row
Exit For
End If
Next rngCell
End Sub

--
Robin Hammond
www.enhanceddatasystems.com
Check out our XspandXL add-in


"Gareth" wrote in message
...
I have a macro to check a column to see if there are any blank cells. It
starts something like this:

For Each cell in Range("F2:F1001")
If cell.Value = "" Then
MsgBox " Please check row " & row number
End if
Next cell

Its the row number I cannot get.

Thanks in advance.

Gareth