G
Guest
Guest
Hello XL-lovers,
Sub Macro1()
Range("F2").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"MARTIN!R2C1:R155C8", TableDestination:="R2C10", TableName:="Draaitabel1"
ActiveSheet.PivotTables("Draaitabel1").AddFields RowFields:= _
"Project Amborgh Amveste"
ActiveSheet.PivotTables("Draaitabel1").PivotFields("Project Amborgh Amveste"). _
Orientation = xlDataField
End Sub
In the macro stands:
SourceData:="MARTIN!R2C1:R155C8"
But if the sheet has a name other then MARTIN I get an error.
I want to play the macro under various sheet names.
How do I do that?!
Sub Macro1()
Range("F2").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"MARTIN!R2C1:R155C8", TableDestination:="R2C10", TableName:="Draaitabel1"
ActiveSheet.PivotTables("Draaitabel1").AddFields RowFields:= _
"Project Amborgh Amveste"
ActiveSheet.PivotTables("Draaitabel1").PivotFields("Project Amborgh Amveste"). _
Orientation = xlDataField
End Sub
In the macro stands:
SourceData:="MARTIN!R2C1:R155C8"
But if the sheet has a name other then MARTIN I get an error.
I want to play the macro under various sheet names.
How do I do that?!