Find and Replace Macro

ls010s

New Member
Joined
May 8, 2013
Messages
16
Hi

I need some help with a file I am working with.

On Sheet 1, I have data which is downloaded from a system with inconsistent data. I have a list of all the possible "find and replace" items I need to run in column B of sheet 1 to make it consistent.

If in sheet 2 column A and B, I copy all these find and replace items (i.e. find "-" and replace with "/" and so on), how can I set up a macro to look at sheet 2, column a and b and replace in sheet 1 in column B instead of me updating the code every time a new find and replace item is added?

The total list is currently at 90 and every time something changes I have to update the VBA code to ensure that the find and replace macro works which can be time consuming. I am using Office 2007.

Thanks for the help.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Right click on Sheet2 tab and choose view code and paste this code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
If Target.Offset(0, -1).Value = "" Then
   Exit Sub
Else
   Sheets("Sheet1").Range("B:B").Replace Target.Offset(0, -1).Value, Target.Value
End If
End Sub
Note:This will work if you put the value in column A first then the value in column B e.g: A5 = "/" without the qoutes"" and B5 = ","
ZAX
 
Upvote 0
So, I've already posted a new question but it seems like mine could piggy back onto this solution ... I have the listing of items to Find and Replace on one tab.

But I need to search the complete workbook and I have several workbooks, so I'm thinking I build the Macro in the Workbook with the Find/Replace info and then run it on the other workbooks.

My problem ... I've never done a macro before. I 135 items to search on and a dozen workbooks. so I am trying to avoid 1620 find/replace sequences.

Any ideas?

Thanks in advance for your time and assistance.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,126
Members
452,381
Latest member
Nova88

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