Advanced Find

Andrew XJ

Board Regular
Joined
Feb 21, 2002
Messages
77
The find object(what:=) is the contents of two cells? how to perform this?
eg.
in Range("A1:Y50"), i want to find two horizontally consecutive cells that have values "value1" and "value2" respectively.

regards
Andrew XJ
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi Andrew

Try

Sub FindThem()
Dim Rfound As Range
Dim iLoop As Integer

Set Rfound = Range("A1")
For iLoop = 1 To WorksheetFunction.CountIf(Range("A1:Y50"), "Value1")
Set Rfound = Range("A1:Y50").Find(What:="Value1", After:=Rfound, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Rfound.Offset(0, 1) = "Value2" Then
Rfound.Range("A1:B1").Select
Exit For
End If
Next iLoop
End Sub
 
Upvote 0
Thank you very much, Dave!!
I am always trying to find some stuff in the embedded VBA to solve my problem. Learning from you. I think for most problem we can use UDF to solve it.
 
Upvote 0

Forum statistics

Threads
1,214,412
Messages
6,119,369
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top