I have pieced together different bits of code over the past few years to format a P&L report being generated from an accounting system. The vba is starting to run slowly and I'm trying to clean it up to make it run a faster.
The report being formatted has 100 tabs and the code formats each tab exactly the same. I'm interested to see if there is a more efficient way to find and replace text in column A. The code loops through each sheet, selects Column A, and finds and replaces text within column A. In total there are 75+ items that are replaced.
- I've read that using "Select" is not the best practice - is there a better way to find a replace?
- This currently loops through each sheet in the workbook - is there a way to find and replace in Column A for the entire workbook at once?
Thanks in advance for any suggestions.
The report being formatted has 100 tabs and the code formats each tab exactly the same. I'm interested to see if there is a more efficient way to find and replace text in column A. The code loops through each sheet, selects Column A, and finds and replaces text within column A. In total there are 75+ items that are replaced.
- I've read that using "Select" is not the best practice - is there a better way to find a replace?
- This currently loops through each sheet in the workbook - is there a way to find and replace in Column A for the entire workbook at once?
Code:
For Each Sh In Worksheets Sh.Activate
Columns("A:A").Select
Selection.Replace What:="[OperatingIncome] ", Replacement:=""
Selection.Replace What:="_OtherIncome]", Replacement:=""
Selection.Replace What:="_TicketIncome]", Replacement:=""
Next Sh
Thanks in advance for any suggestions.