View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Row number of a specific value

If you have your colours + the field name in A1 to A4 then this will do:

Sub test()

On Error GoTo ERROROUT

MsgBox Range(Cells(1), Cells(4, 1)).Find(What:="blue", _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False).Row, , _
"row number of the cell with
blue"
Exit Sub
ERROROUT:

MsgBox "No cell found with blue in that range"

End Sub


RBS

wrote in message
ups.com...
Hi,
How do I get the row number of a specific cell?
Lets suppose I have a column colour

Colour
black
blue
green

and I'd like to get the row number of the cell containing the value
blue.
How can I do it?

Thanks
Faby