Need macro for mass control find replace

tonyjyoo

Board Regular
Joined
Aug 5, 2016
Messages
167
Hello,

I have a workbook I update every month, and currently I have just been using control find replace to update. However, this takes me 10+ minutes for each of 5 tabs, as there are thousands of cells it needs to replace that is linking to a previous month's file.

Is there a way to quickly do this? I've tried everything I know.

Thanks,
Tony
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hello,

I have a workbook I update every month, and currently I have just been using control find replace to update. However, this takes me 10+ minutes for each of 5 tabs, as there are thousands of cells it needs to replace that is linking to a previous month's file.

Is there a way to quickly do this? I've tried everything I know.

Thanks,
Tony

bump
 
Upvote 0
Hello,

I have a workbook I update every month, and currently I have just been using control find replace to update. However, this takes me 10+ minutes for each of 5 tabs, as there are thousands of cells it needs to replace that is linking to a previous month's file.

Is there a way to quickly do this? I've tried everything I know.

Thanks,
Tony

Have you tried recording a macro, and then building a loop to loop through the worksheets?
 
Upvote 0
Your requirement is far too broad to expect a resolution straight off the bat.

Why did recording a macro not help?

Can you provide the vba code your recorded macro produced? Either I or other members of this forum will be able to help if we have an idea what you are trying to achieve, such as target & replacement values, ranges, sheets etc.

Cheers
John
 
Last edited:
Upvote 0
Your requirement is far too broad to expect a resolution straight off the bat.

Why did recording a macro not help?

Can you provide the vba code your recorded macro produced? Either I or other members of this forum will be able to help if we have an idea what you are trying to achieve, such as target & replacement values, ranges, sheets etc.

Cheers
John

The below code is what I have tried, but still has no success, takes minutes to complete.

Code:
Sub Macro1()
 
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
 
    ' fill your range in here
    Range("A1:AN350").Select
    ' choose what to search for and what to replace with here
    Selection.Replace What:="03 NPH Cash Position 17", Replacement:="02 NPH Cash Position 17", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
 
    Application.EnableEvents = True
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic
    Application.CalculateFull
 
End Sub

Your feedback is greatly appreciated.
 
Upvote 0
Hi Tony,

This forum is awash with far more competent and knowledgeable folk than me who may have alternative methods, but that is how I would have gone about it too.

I just mocked up a sheet of the same sized range, the actual find & replace only took around 5-10 secs on my pretty meagre work PC. The bottleneck is the subsequent recalculating of up-to 70,000 formulae (350 [rows] * 40 [columns] * 5 [sheets]), exacerbated greatly if the formula are referencing external data sources.

I'd love to be proved wrong, but I think the only way you'll speed it up is by improving the efficiency of your sheets. What data are they pulling from the other document/sheets? Could the same result be achieved by connecting the other document(s) as a data source and then referencing them locally?
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,936
Members
449,094
Latest member
teemeren

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