Hi there,
I'm trying to get myself a couple of macro's working, however there are a few errors I'm walking into:
1. When doing a VLOOKUP between 2 sheets in the same workbook, it randomly #N/A's certain hits, this does not happen when I do the same VLOOKUP on separate workbooks.
2. When creating a pivot table with a macro, I get this error when clicking my macro button I just created. (the code in /B is the one that is turning yellow in excel)
Cells.Select
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Orders!R1C1:R1048576C9", Version:=xlPivotTableVersion15).CreatePivotTable _
TableDestination:="Sheet4!R3C1", TableName:="PivotTable1", DefaultVersion _
:=xlPivotTableVersion15
Sheets("Sheet4").Select
Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("quantity_requested"), "Count of quantity_requested" _
, xlCount
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Partner Manager")
.Orientation = xlColumnField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Partner Name")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("item_name")
.Orientation = xlRowField
.Position = 2
End With
Sheets("Orders").Select
Range("A10").Select
End Sub
What am I missing here?
Much appreciated!!
I'm trying to get myself a couple of macro's working, however there are a few errors I'm walking into:
1. When doing a VLOOKUP between 2 sheets in the same workbook, it randomly #N/A's certain hits, this does not happen when I do the same VLOOKUP on separate workbooks.
2. When creating a pivot table with a macro, I get this error when clicking my macro button I just created. (the code in /B is the one that is turning yellow in excel)
Cells.Select
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Orders!R1C1:R1048576C9", Version:=xlPivotTableVersion15).CreatePivotTable _
TableDestination:="Sheet4!R3C1", TableName:="PivotTable1", DefaultVersion _
:=xlPivotTableVersion15
Sheets("Sheet4").Select
Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("quantity_requested"), "Count of quantity_requested" _
, xlCount
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Partner Manager")
.Orientation = xlColumnField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Partner Name")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("item_name")
.Orientation = xlRowField
.Position = 2
End With
Sheets("Orders").Select
Range("A10").Select
End Sub
What am I missing here?
Much appreciated!!