Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Row number of a specific value

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Row number of a specific value

This one looks in column A

Sub color()

For r = 1 To 10
If Cells(r, 1).Interior.ColorIndex = 5 Then
MsgBox ("Row ") & r
End If
Next

End Sub


" skrev:

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Row number of a specific value

=MATCH("blue",A1:A20,0)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Row number of a specific value

Hi! Thank you very much for all your answers!! It's all working fine
now.
Faby

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to calculate number of occurencies of a specific number number Stefan Excel Discussion (Misc queries) 4 September 8th 08 08:33 AM
Linking a Specific Word to a Specific Number [email protected] Excel Worksheet Functions 1 July 11th 06 05:55 PM
Linking a Specific Word to a Specific Number [email protected] Excel Worksheet Functions 2 July 11th 06 05:50 PM
Linking a Specific Word to a Specific Number [email protected] Excel Worksheet Functions 1 July 11th 06 04:29 PM
Count number of times a specific number is displayed in a cell ran subs Excel Worksheet Functions 1 June 27th 05 05:01 PM


All times are GMT +1. The time now is 12:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"