Johnny Thunder
Well-known Member
- Joined
- Apr 9, 2010
- Messages
- 693
- Office Version
- 2016
- Platform
- MacOS
Not sure what is wrong with my code but it is erroring outon one line, I am not sure why the select command is not working?
My code
My code
Code:
Option Explicit
'--------------------------------------------------------
'--- Updates ByCostCenter Sheet
'---------------------------------------------------------
Sub ByCostCenterCopyPast()
Dim lRow As Long
Dim Sht As Worksheet
Set Sht = Sheets("By Cost Center")
lRow = Sht.Cells(Rows.Count, 13).End(xlUp).Row '13 refers to the row to start on
Application.DisplayAlerts = False
Application.ScreenUpdating = False
TimeStamp
With Sheets("Query Results")
.Visible = True
.Range("AR1:AR9").Copy .Range("AS1:JG9")
Calculate
.Range("AS1:JG9").Copy
.Range("AS1:JG9").PasteSpecial Paste:=xlPasteValues
Calculate
.Range("A12:AF12").Copy .Range("A13:AF10000")
.Range("A13:AF10000").Copy
.Range("A13:AF10000").PasteSpecial Paste:=xlPasteValues
.Range("JS12:KA12").Copy .Range("JS13:KA10000")
Calculate
.Range("JS13:KA10000").Copy
.Range("JS13:KA10000").PasteSpecial Paste:=xlPasteValues
.Visible = False
End With
Sheets("PARAMETERS").Range("V57:Y58").Copy
Sheets("By Cost Center").Range("A4:D5").PasteSpecial Paste:=xlPasteValues
Sheets("By Cost Center").Select
Range("F13").Select
With Sht 'Sheet By Cost Center
.PivotTables("PivotTable3").PivotCache.Refresh '<-----------------Hidden Pivot Table in Column F on By Cost Center Tab--------------------
.Range("$A$10:$CD$652").AutoFilter
.Range("$A$10:$CD$652").AutoFilter Field:=5
.Range("A12:E12").Copy
.Range("A13:E652").PasteSpecial Paste:=xlPasteFormulas
.Range("G12:CD12").Copy
.Range("G13:CD652").PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Calculate
.Range("A13:E" & lRow & "").Copy
.Range("A13:E" & lRow & "").PasteSpecial Paste:=xlPasteValues
.Range("G13:CD" & lRow & "").Copy
.Range("G13:CD" & lRow & "").PasteSpecial Paste:=xlPasteValues
.Range("$A$10:$CD$652").AutoFilter Field:=5, Criteria1:="<>"
End With
Sheets("PARAMETERS").Range("AH59").Copy
Sheets("Summary by Quarter").Range("B4").PasteSpecial Paste:=xlPasteValues
Sheets("PARAMETERS").Range("W57:X57").Copy
Sheets("Summary").Range("B6:C6").PasteSpecial Paste:=xlPasteValues
Sheets("BPC Hierarchy by Cost Center").Activate
UpdateBPChierarchyReport 'Macro Call
Sheets("By Ter-Dep-BU-Cst-Com-Pft").Activate
By_Ter_BU_Dep_Flat_File 'Macro Call
Sheets("PARAMETERS").Range("v28").Select 'Line that has the errors-------------------------------------------------------------------------------
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub