View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tomo Tomo is offline
external usenet poster
 
Posts: 13
Default vb programing match function


"Nigel" wrote in message
...
Assume your values are stored in range a1 to a3 then try this....

Sub test()
Dim r As Range, c As Range, myRow As Long, myCol As Integer
Set r = Range("A1:A3")

For Each c In r
If InStr(1, c.Value, "005040037 34") 0 Then
myRow = c.Row
myCol = c.Column
End If
Next c

MsgBox myRow
MsgBox myCol

End Sub


--

Regards,
Nigel




"Tomo" wrote in message
...
SPRING/SUMMER JANUARY Red Tab Guys 005010234 30 2
SPRING/SUMMER DECEMBER Red Tab Guys 005040037 32 4
SPRING/SUMMER DECEMBER Red Tab Guys 005040037 34 6


How to find with visual basic code in witch row and column is data with
match 005040037 and 34,
or in this case 3rd row??

Tnx in advance!


model size quantity
005010234 30 2
005040037 32 4
005040037 34 6



Sub test()
Dim r As Range, c As Range, myRow As Long, myCol As Integer
Set r = Range("a1:e3")

For Each c In r
If InStr(1, c.Value, "005040037") 0 Then
myRow = c.Row
myCol = c.Column
End If
Next c

MsgBox myRow
MsgBox myCol

End Sub

that works fine, but i need match for 2 values "005040037" and "34"