View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Always Learning Always Learning is offline
external usenet poster
 
Posts: 25
Default how to extract the row number of a cell with certain value

Hi There,
Think this will work. Just from memory so please forgive me if I have missed
something.

Dim RowNum As Integer
Dim ColNum as Integer
Dim RowFoundOn as Integer
Dim ImFinished as Boolean

RowNum = 0
ColNum = 1 '*** set to column A, change to the column containing values
you are searching for.
Do
RowNum = RowNum + 1
Cells(RowNum,ColNum).Select
If Cells(RowNum,ColNum).Value = "1-A54"
RowFoundOn = ActiveCell.Row
ImFinished = True
End If
Loop Until ImFinished

All the best,

Steve Wilson.


"houston city" wrote in message
...
Hi, I am trying to extract the row number of a cell with a particular
value. For example, I have a cell with the value '1-A54' in it, and I
am trying to get the row number where this value appear. Can anybody
tell me how to write it in VBA? Thanks a lot.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!