Hi all,
I am trying to create a pivot table in a specific cell on a sheet. The
code I have is below. Basically I want to create pivot table so it
appears in the cell I have named as PTCell. PLEASE HELP as this does
not work
Private Sub MovPivot()
Dim PTCell As Range
'Pass heading to a String variable
'strField = Selection.Cells(1, 1).Text
'Name the list range
Sheets("Mobile").Activate
ActiveSheet.Range("A1").Select
ActiveCell.End(xlToRight).End(xlDown).Select
Range(ActiveCell, "A1").Select
Selection.Name = "Data"
Range("A1").Select
ActiveCell.End(xlDown).Offset(2, 0).Select
Set PTCell = ActiveCell
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"Data").CreatePivotTable TableDestination:= _
"'[DSG B&B Template.xls]Mobile'!PTCell",
TableName:="PivotTable1", _
DefaultVersion:=xlPivotTableVersion10
--
moglione1
------------------------------------------------------------------------
moglione1's Profile:
http://www.excelforum.com/member.php...o&userid=26414
View this thread:
http://www.excelforum.com/showthread...hreadid=515279