I'm trying to use a workbook variable in my script to use one macro for multiple data groups. Basically, my goal is to use two workbook variables to designate a "data" excel file and a "Review" excel file, and to use those variables to drive scripts that I originally hard-coded the file names into (but had to make one copy of the script for each group). The issue seems to arise when the script attempts to activate the row "wbkrev.Worksheets("BS Reserves").Activate", at which point the system throws up "Run-time error '424': Object required".
For reference sake, CM and PM are dates on the file names. I would appreciate any ideas as to how to get past this issue. Or is it a case where the variable established in Test190Reformat does not carry over to Comp190TOH?
For reference sake, CM and PM are dates on the file names. I would appreciate any ideas as to how to get past this issue. Or is it a case where the variable established in Test190Reformat does not carry over to Comp190TOH?
VBA Code:
Sub Test190Reformat()
Dim wbkdata As Workbook
Dim wbkrev As Workbook
Workbooks.Open (ThisWorkbook.Path & "\HMS Data Files\190 TOH " & CM & ".xlsx")
Set wbkdata = ActiveWorkbook
Workbooks.Open (ThisWorkbook.Path & "\190 TOH AR Review " & CM & ".xlsx")
Set wbkrev = ActiveWorkbook
'Following macro assumes data tab already sorted
Call Comp190TOH
wbkdata.Activate
ActiveWorkbook.Save
ActiveWorkbook.Close
wbkrev.Activate
ActiveWorkbook.Save
ActiveWorkbook.Close
End If
End Sub
VBA Code:
Sub Comp190TOH()
Application.ScreenUpdating = False
wbkvlook = "190 TOH AR Review " & PM
wbkrev.Worksheets("Reserves").Activate
'Following attempts to combine all activities for each tab into a tab specific macro
Call IPNONMC
Call MCIH
Call MCDIS
End Sub