VBA - Error in code - Pivot Cache

candacem

New Member
Joined
Sep 8, 2017
Messages
18
This is my pivot cache but I keep getting an error message :( My google cave isn't helping so hoping one of you genius' are able to help.

Thanks in advance!

ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Sum_Data!R1C1:R5000C19", Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="", TableName:="Pivot!R1C1", DefaultVersion:=xlPivotTableVersion14
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
My guess is that error is in:
Code:
With myPivotTable
	With .PivotFields("Class").Orientation = xlRowField
		With .PivotFields("Jan-18")
			.Orientation = xlDataField
			.Position = 1
			.Functiom = xlSum
			.NumberFormat = "#,##0.00"
		End With
	End With


	With Application
		.ScreenUpdating = True
		.EnableEvents = True
	End With
End With



Change it to (first make a copy of your subroutine for backup):
Code:
With myPivotTable
	.PivotFields("Class").Orientation = xlRowField
	With .PivotFields("Jan-18")
		.Orientation = xlDataField
		.Position = 1
		.Functiom = xlSum
		.NumberFormat = "#,##0.00"
	End With
End With
	
With Application
	.ScreenUpdating = True
	.EnableEvents = True
End With
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top