There is a part of my code:
This code is in Workbook named main.xlsm.
I have to open the second workbook named data.xlsm to make it work.
Is there a way to change Workbooks(main.xlsm).Activate for something that will always come back to the workbooks the VBA procedure is written into? I would like to change the name of my file (main.xlsm) and not always go back to my VBA code to correct it.
thanks
Code:
Workbooks(data.xlsm).Activate
Worksheets(y).Activate
Range("A2:G" & Range("A2").End(xlDown).Row).Select
Selection.Copy
Workbooks(main.xlsm).Activate
Worksheets("maindata").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
I have to open the second workbook named data.xlsm to make it work.
Is there a way to change Workbooks(main.xlsm).Activate for something that will always come back to the workbooks the VBA procedure is written into? I would like to change the name of my file (main.xlsm) and not always go back to my VBA code to correct it.
thanks