Sub CopyProjectNumbers()
'*************G Heyman
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim pt As PivotTable
' Specify the worksheet containing the PivotTable
Set ws = ThisWorkbook.Sheets("Proj Actuals")
' Specify the PivotTable by name
Set pt = ws.PivotTables("PivotTableProjAct")
Sheets("Data_Fields").Visible = True
' Copying values from "Est. Method" sheet cell F5
Sheets("Est. Method").Range("F5").Copy
' Pasting special values to "Data_Fields" sheet cell B6. This is the UD_ProjectNumbers table that is used to filter data on load.
Sheets("Data_Fields").Range("B7").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
' Clear the clipboard
Application.CutCopyMode = False
Sheets("Data_Fields").Visible = xlSheetVeryHidden
If Sheets("Est. Method").Range("F5").Value <> "" Then
Sheets("ProjectAct").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
' Refresh the PivotTable
pt.RefreshTable
Sheets("ProjectAct").Range("A4").Value = "Last Refreshed on: " & Now
Sheet15.Select
Sheet15.Range("N4").Value = "Proj Actuals: " & Now
Else
MsgBox "You must insert Projct ID(s)"
End If
Application.ScreenUpdating = True
Sheet15.Select
End Sub