We have a huge folder containing office documents on our server. IT wants to change the name of the folder from Mehper_repository to Planning_reports. Since most of the Excel files in the subfolders are linked to each other, I need to find and replace every single cell content containing \\FileSrv\Mehper_repository\ to \\FileSrv\Planning_reports\. The problem is, Excel's Find/Replace utility can search only within Sheet or Workbook. How can I search within a folder/subfolders just looking in Formulas and replace that expression?
| |||
|
feedback
|
|
I would suggest the commercial product PowerGREP :
| ||||
|
feedback
|
|
Building off TomWij's answer, loop through all the cells, looking for references to "\FileSrv\Mehper_repository\" and replace with "\FileSrv\Planning_reports\". You might be able to use the Cells collection to do it faster, but that might muck around with the formulae in bad ways (especially since that string won't be isolated). Try asking about writing VBA like this on StackOverflow, you're more likely to get a programming-related response there than on SuperUser. | |||
|
feedback
|
|
A macro approach: I can't answer this exactly, but what about using a macro program so the only thing you have to do is opening the files one-by-one and running the macro? That might be feasible if the collection is not too large, if not, you will probably have to come up with programming a custom solution... Programming a custom automatic solution: Building off A. Scagnelli's answer, you can take your favorite .NET language and do (C# examples):
Pseudo code:
Explanation: Just pass the path to the parent directory and a reference to a list along when you call them recursively. This allows you to get a list of folders which files you can enumerate in a double loop. Leave Excel open during the whole algorithm, just 'open, replace and close' in the inner loop. | ||||
feedback
|
