Like Function in VBA/Macros

fahadakbar

Board Regular
Joined
May 15, 2014
Messages
63
Hello,

i am tring to run a "For Each" Loop in excel with the condition that if cells in selecton trends ("Like") with another range.

Range("A:A").Select
For Each MyCell In Selection
If Mycell.value Like Range("B:B")

Now I am not sure if I can run Like function against a range ... it works if i change range to a single cell

I want this because i have two column data, both contains client names, however names in both columns are slightly
different ... (Like Colum A has ABC INC and Column B has ABC INC. ) so idea is to replace name in column A with Column B

Thanks for Help
 
Welcome to MrExcel.

Are the names always adjacent to each other?

Code:
If Left(Mycell.Offset(, 1).Value, Len(Mycell.Value)) = Mycell.Value Then
 
Upvote 0

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