Forum Discussion
new VBA code release and update of several WB with the same VBA code
Yes, I used the tool you refer but I have a problem. In every workbook say A.xlsm I have two VBA Project the first is the VBA project of the workbook A itself and the other is the VBA Project Personal.xslb which contains the code to be executed by every workbook. When this code refers to sheets and cells of A I have a run time error probably because code is working in the workbook Personal.xslb. Is there any way to refer to sheets and cells of the workbook A?
Hi,
From the beginning, I supposed that the code stored in every workbook is exactly the same!
Which means that the code hasn't a specific sheets names or range names associated with one workbook without the other, and the code is applied to the same cell ranges.
But you can store the code in the Personal Macro Workbook and make it generic by using some tricks.
For example, you could use the below code to apply the code to the active sheet of the active workbook instead of a specific sheet name in a specific workbook:
ActiveWorkbook.ActiveSheet.Range("A1").Select
You could also use IF statement to check if a specific workbook is active and apply a specific code to it.
Regards