I have created a spreadsheet that pulls all data as required but when the code runs to Macro3, it gets hung up and will not paste into my sheet. If someone can tell me what I could use to make this work for a paste of the tab named what is in cell N16, I would appreciate it...
The process runs through the open of Macro3 but not any further.
Thank you,
Ray
The process runs through the open of Macro3 but not any further.
Code:
Option Private Module
Sub Macro1()
Dim ws As Worksheet
Set ws = Sheets("Start")
MsgBox ("Update may take several minutes, Click Ok to begin")
Workbooks.Open ws.Range("N10").Value
'Selection.AutoFilter
Range("A1:P224").Select
Selection.Copy
Windows("VBA Extractor r57with code V2.xlsm").Activate
Worksheets("Invoice Summary").Activate
ActiveCell.Offset(0, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False
Call Macro2(ws)
End Sub
Sub Macro2(ws As Worksheet)
' Macro2 Macro
'
' Keyboard Shortcut: Ctrl+f
'
Workbooks.Open ws.Range("N12").Value
'Selection.AutoFilter
ActiveCell.Offset(0, 0).Range("A1:AQ35000").Select
Selection.Copy
Windows("VBA Extractor r57with code V2.xlsm").Activate
Worksheets("Vendor Master").Activate
ActiveCell.Offset(-1, 0).Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False
Call Macro3(ws)
End Sub
Sub Macro3(ws As Worksheet)
'
' Macro3 Macro
'
' Keyboard Shortcut: Ctrl+g
'
Workbooks.Open ws.Range("N14").Value
'Worksheets wks.Range("N16").Activate
'
'
Dim wks As Excel.Worksheet
On Error Resume Next
Set wks = ThisWorkbook.Worksheets(Sheets("Start").Range("N16").Value)
On Error GoTo 0
If Not wks Is Nothing Then
Call wks.Activate
'Worksheets("July 2018").Activate
Range("A3").Select
Selection.AutoFilter
Columns("A:E").Select
Selection.EntireColumn.Hidden = False
Rows("3:3").Select
Selection.AutoFilter
ActiveCell.Offset(0, 0).Range("A2:BR26000").Select
ActiveSheet.Range("$E2").AutoFilter Field:=5, Criteria1:= _
"Vendor"
Selection.Copy
Windows("VBA Extractor r57with code V2.xlsm").Activate
Worksheets("Const. Prog. Rpt Switches").Activate
ActiveCell.Offset(0, 0).Range("A1").Select
'ActiveCell.Offset(0, 0).Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False
Call refresh
End If
End Sub
' Refresh all applicable pivot tables to setup month's data
Sub refresh()
'
' refresh Macro
' refresh data
'
' Keyboard Shortcut: Ctrl+r
' replace with Refresh All (had to remove the check for Enable Background refresh to make it wait)
ActiveWorkbook.RefreshAll
' Refresh all Pivot tables in all worksheets
Dim shtTemp As Worksheet
Dim pvtTable As PivotTable
For Each shtTemp In ActiveWorkbook.Worksheets
For Each pvtTable In shtTemp.PivotTables
pvtTable.RefreshTable
Next
Next
MsgBox ("Update Complete,All data is Up-to date")
End Sub
Thank you,
Ray