Easy Question

KOK

Board Regular
Joined
Aug 9, 2010
Messages
115
Hello All,

I have a following code in which I want to use value of Lookat and MatchCase based upon the value in cell B8 and B9 resprctively.

For ex. If cell B8 has value "No" then Lookat will search xlpart and if "Yes" then Lookat will search xlwhole.

and for match case if the cell value is "Yes" then it will search matchcase as TRUE and if "No" then it will search as FALSE.

wSheet.Cells.Replace What:=Search, Replacement:=Replacement, Lookat:=xlWhole, MatchCase:=True.

Thanks in Advance!!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
For example:
Code:
wSheet.Cells.Replace What:=Search, Replacement:=Replacement, Lookat:=iif(lcase$(Range("B8").value)="no",xlPart,xlWhole), MatchCase:=iif(lcase$(Range("B9").value)="no",False,True)
 
Upvote 0
For example:
Code:
wSheet.Cells.Replace What:=Search, Replacement:=Replacement, Lookat:=iif(lcase$(Range("B8").value)="no",xlPart,xlWhole), MatchCase:=iif(lcase$(Range("B9").value)="no",False,True)


Thanks RoryA for your great Help!!..
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,956
Latest member
JPav

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