alexaronson
Active Member
- Joined
- Sep 30, 2005
- Messages
- 314
Hello and thank you for looking at my question.
I have code in my macro that decleares the workbook and sheets which makes the code run much much faster.
One of the problems I run into is that my users sometimes saves the workbook under a different name and that cause my code problems, because the code is looking for a specific workbook name.
Typically when I or my users execute the file with this naming process the macro takes less than 1 second to process.
However, when trying to make the Workbook name flexible by changing to this:
The code is taking 5 times longer.
Any suggestions on how to make the Workbook name flexible without really slowing down my macro?
Thanks
I have code in my macro that decleares the workbook and sheets which makes the code run much much faster.
One of the problems I run into is that my users sometimes saves the workbook under a different name and that cause my code problems, because the code is looking for a specific workbook name.
Code:
Dim Wb as WorkBook
Dim S1 as WorkSheet
Set Wb = Workbooks("ExampleFile.xlsm")
Set S1 as WorkSheets("Sheet1")
Typically when I or my users execute the file with this naming process the macro takes less than 1 second to process.
However, when trying to make the Workbook name flexible by changing to this:
Code:
Set Wb = Workbooks(ActiveWorkbook.Name)
The code is taking 5 times longer.
Any suggestions on how to make the Workbook name flexible without really slowing down my macro?
Thanks