I am receiving an error at the Sub Macro2 script for the line of code: "Workbooks.Open Range("N12").
Value where it tells me that it is N12 empty.
How can I reactivate the sheet to pull the file name variable in the file I wrote code in N10, N12, and N14.
N10 works as the sheet is activated.
When it tries for N12, the sheet is no longer activated.
Please let me know if you can assist me on this issue.
Thank youm,
Ray
Value where it tells me that it is N12 empty.
How can I reactivate the sheet to pull the file name variable in the file I wrote code in N10, N12, and N14.
N10 works as the sheet is activated.
When it tries for N12, the sheet is no longer activated.
Please let me know if you can assist me on this issue.
Thank youm,
Ray
Code:
[COLOR=#333333]Option Private Module[/COLOR]
[COLOR=#333333]Sub Macro1()[/COLOR]
[COLOR=#333333]MsgBox ("Update may take several minutes, Click Ok to begin")[/COLOR]
[COLOR=#333333]Workbooks.Open Range("N10").Value[/COLOR]
[COLOR=#333333]'Selection.AutoFilter[/COLOR]
[COLOR=#333333]Range("A1:P224").Select[/COLOR]
[COLOR=#333333]Selection.Copy[/COLOR]
[COLOR=#333333]Windows("VBA Extractor r57with code V2.xlsm").Activate[/COLOR]
[COLOR=#333333]Worksheets("Invoice Summary").Activate[/COLOR]
[COLOR=#333333]ActiveCell.Offset(0, 0).Range("A1").Select[/COLOR]
[COLOR=#333333]Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _[/COLOR]
[COLOR=#333333]xlNone, SkipBlanks:=False[/COLOR]
[COLOR=#333333]Call Macro2[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
[COLOR=#333333]Sub Macro2()[/COLOR]
[COLOR=#333333]' Macro2 Macro[/COLOR]
[COLOR=#333333]'[/COLOR]
[COLOR=#333333]' Keyboard Shortcut: Ctrl+f[/COLOR]
[COLOR=#333333]'[/COLOR]
[COLOR=#333333]Workbooks.Open Range("N12").Value[/COLOR]
[COLOR=#333333]'Selection.AutoFilter[/COLOR]
[COLOR=#333333]ActiveCell.Offset(0, 0).Range("A1:AQ35000").Select[/COLOR]
[COLOR=#333333]Selection.Copy[/COLOR]
[COLOR=#333333]Windows("VBA Extractor r57with code V2.xlsm").Activate[/COLOR]
[COLOR=#333333]Worksheets("MyVendor Master").Activate[/COLOR]
[COLOR=#333333]ActiveCell.Offset(-1, 0).Range("A2").Select[/COLOR]
[COLOR=#333333]Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _[/COLOR]
[COLOR=#333333]xlNone, SkipBlanks:=False[/COLOR]
[COLOR=#333333]Call Macro3[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
[COLOR=#333333]Sub Macro3()[/COLOR]
[COLOR=#333333]'[/COLOR]
[COLOR=#333333]' Macro3 Macro[/COLOR]
[COLOR=#333333]'[/COLOR]
[COLOR=#333333]' Keyboard Shortcut: Ctrl+g[/COLOR]
[COLOR=#333333]'[/COLOR]
[COLOR=#333333]Workbooks.Open Range("N14").Value[/COLOR]
[COLOR=#333333]Worksheets("July 2018").Activate[/COLOR]
[COLOR=#333333]Range("A3").Select[/COLOR]
[COLOR=#333333]Selection.AutoFilter[/COLOR]
[COLOR=#333333]Columns("A:E").Select[/COLOR]
[COLOR=#333333]Selection.EntireColumn.Hidden = False[/COLOR]
[COLOR=#333333]Rows("3:3").Select[/COLOR]
[COLOR=#333333]Selection.AutoFilter[/COLOR]
[COLOR=#333333]ActiveCell.Offset(0, 0).Range("A2:BR26000").Select[/COLOR]
[COLOR=#333333]ActiveSheet.Range("$E2").AutoFilter Field:=5, Criteria1:= _[/COLOR]
[COLOR=#333333]"MyVendor"[/COLOR]
[COLOR=#333333]Selection.Copy[/COLOR]
[COLOR=#333333]Windows("VBA Extractor r57with code V2.xlsm").Activate[/COLOR]
[COLOR=#333333]Worksheets("Const. Prog. Rpt Switches").Activate[/COLOR]
[COLOR=#333333]ActiveCell.Offset(0, 0).Range("A1").Select[/COLOR]
[COLOR=#333333]'ActiveCell.Offset(0, 0).Range("A2").Select[/COLOR]
[COLOR=#333333]Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _[/COLOR]
[COLOR=#333333]xlNone, SkipBlanks:=False[/COLOR]
[COLOR=#333333]Call refresh[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
[COLOR=#333333]' Refresh all applicable pivot tables to setup month's data[/COLOR]
[COLOR=#333333]Sub refresh()[/COLOR]
[COLOR=#333333]'[/COLOR]
[COLOR=#333333]' refresh Macro[/COLOR]
[COLOR=#333333]' refresh data[/COLOR]
[COLOR=#333333]'[/COLOR]
[COLOR=#333333]' Keyboard Shortcut: Ctrl+r[/COLOR]
[COLOR=#333333]' replace with Refresh All (had to remove the check for Enable Background refresh to make it wait)[/COLOR]
[COLOR=#333333]ActiveWorkbook.RefreshAll[/COLOR]
[COLOR=#333333]' Refresh all Pivot tables in all worksheets[/COLOR]
[COLOR=#333333]Dim shtTemp As Worksheet[/COLOR]
[COLOR=#333333]Dim pvtTable As PivotTable[/COLOR]
[COLOR=#333333]For Each shtTemp In ActiveWorkbook.Worksheets[/COLOR]
[COLOR=#333333]For Each pvtTable In shtTemp.PivotTables[/COLOR]
[COLOR=#333333]pvtTable.RefreshTable[/COLOR]
[COLOR=#333333]Next[/COLOR]
[COLOR=#333333]Next[/COLOR]
[COLOR=#333333]MsgBox ("Update Complete,All data is Up-to date")[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
Last edited by a moderator: