I have 2 macros that I am trying to amalgamate.
Macro1 uses an InputBox to get data from the User and stores the answer in a specific sheet in the Template that is opened to run the macro. The code for macro 1 is:-
Macro 2 starts off with the statements:-
It then proceeds to use the following command:-
to save 12 workbooks with the names 01 January, 02 February, etc etc etc.
I am attempt to amalgamate the 2 macros, I get the error “Compiler error: Variable not found” against the line fPath = ThisWorkbook.Path & "\".
When I run the macros individually or call macro 2 from macro 1, then no problems are encountered.
Any assistance offered would be gratefully received.
Macro1 uses an InputBox to get data from the User and stores the answer in a specific sheet in the Template that is opened to run the macro. The code for macro 1 is:-
VBA Code:
Dim myYear As Integer
myYear = InputBox("Please enter the year (Format YYYY) that you want to create monthly Sheets for", "Enter Year")
Sheets("Formula").Select
Range("R2").Value = myYear
ActiveWorkbook.Save
Macro 2 starts off with the statements:-
VBA Code:
Dim ws As Worksheet
fPath = ThisWorkbook.Path & "\"
It then proceeds to use the following command:-
VBA Code:
ActiveWorkbook.SaveAs Filename:=fPath & "01 January.xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
to save 12 workbooks with the names 01 January, 02 February, etc etc etc.
I am attempt to amalgamate the 2 macros, I get the error “Compiler error: Variable not found” against the line fPath = ThisWorkbook.Path & "\".
When I run the macros individually or call macro 2 from macro 1, then no problems are encountered.
Any assistance offered would be gratefully received.