Hi guys,
Appreciate your help. Trying to run this macro. but Runtime error 1004. Formula is not complete. Make sure an ending square bracket ] is not missing. message popped up. How should i go about solving this.
Sheets("TOJ-Pivot").Select
ActiveSheet.PivotTables("PivotTable1").PivotSelect "'Service Order'[All]", _
xlLabelOnly, True
Selection.Copy
Sheets("Single Currency").Select
Range("D20").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Single Currency").Select
Range("D20").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("F20").Select
ActiveCell.FormulaR1C1 = "=IFERROR(VLOOKUP(RC4,'TOJ-Pivot'!C2:C4,3,0),0)"
Range("F20").Select
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Range("F20:F834").Select
ActiveSheet.Paste
Range("E20").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=IF(RC[1]>0,""DR"",""CR"")"
Range("E20").Select
Selection.Copy
Range("E20:E21").Select
Range(Selection, Selection.End(xlDown)).Select
Range("E20:E834").Select
ActiveSheet.Paste
Range("D22").Select
Sheets("Single Currency").Select
Range("E19").Select
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Single Currency").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Single Currency").Sort.SortFields.Add Key:=Range( _
"F20:F835"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Single Currency").Sort
.SetRange Range("A19:H835")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Bookmarks