View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
ankur ankur is offline
external usenet poster
 
Posts: 43
Default How can I get the row number Based on cell value

Hi Kevin,

Try This...

Please note that the function takes the column Number...

Function FindRow(Column1 As Integer, TextToFind As String)
Dim i as integer
Dim cell As Object
For i = 1 To 65536
RowOfText = 0
If Cells(i, Column1).Value < "" Then
If Cells(i, Column1).Value = TextToFind Then
RowOfText = i
GoTo 8
End If
End If
Next i

8: If RowOfText = 0 Then
FindRow = 0
Else
FindRow = RowOfText
End If

End Function

Regards
Ankur / Kanchan
www.xlmacros.com

Kc-Mass wrote:

I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value of
"Fish" and "Fish" is in B1207. I would just like the Function to give back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C