View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default how to find row with a given value in a column

Hi

This is a example with a inputbox
Use the commented line if you want to select the cell

Sub Find_First()
Dim FindString As String
Dim Rng As Range
FindString = InputBox("Enter a Search value")
If Trim(FindString) < "" Then
Set Rng = Range("A:A").Find(What:=FindString, _
After:=Range("A" & Rows.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
'If Not Rng Is Nothing Then Application.Goto Rng, True
If Not Rng Is Nothing Then MsgBox Rng.Row
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"rtos" wrote in message ...
Hello ,
I am trying to do following in vba

name value
a 1
b 2
c 3

I know the name value , how do I find whats the row number where the
name='a'.

thx
ray