floridagunner
Board Regular
- Joined
- Jul 20, 2007
- Messages
- 60
Hello all,
I want to specify the active selection as the range for my pivot table but I keep getting an error message. Funny thing is this recorded code always used to work before but for some reason its not working anymore. The only change I had made in the recorded code was changing source data to selection.
I'm using the code below
Can anyone help me fix this code please ?
I want to specify the active selection as the range for my pivot table but I keep getting an error message. Funny thing is this recorded code always used to work before but for some reason its not working anymore. The only change I had made in the recorded code was changing source data to selection.
I'm using the code below
Code:
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
Selection, Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:="", TableName:="PivotTable4", _
DefaultVersion:=xlPivotTableVersion14
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Move After:=Sheets(Worksheets.Count)
ActiveSheet.Cells(3, 1).Select
Can anyone help me fix this code please ?