Filtering column in Excel spreadsing using VB

T

Taurus

I have two different column one is Wellname and one is parent wellbore
in Excel. When the wellname match with parent welbore in the same row
it will return the search.
What is the syntax I could use in VB? Please advise >
 
J

JE McGimpsey

Taurus said:
I have two different column one is Wellname and one is parent wellbore
in Excel. When the wellname match with parent welbore in the same row
it will return the search.
What is the syntax I could use in VB? Please advise >

Are you just trying to see when two cells in the same row have the same
value?

While you could more efficiently do it with XL formulae, in VBA, one way
would be to use a loop. Assume Wellname is in column A, and parent
wellbore is in column B:


Dim rCell As Range
For Each rCell in Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)
With rCell
If .Value = .Offset(0, 1).Value Then
MsgBox "Wellname matches parent welbore at row " & .Row
Exit For
End If
End With
Next rCell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top