Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I have created a simple macro to perform a task to put some data into pivot table. The only problem I have with this is that before I run the macro I will always have to change the Sheet Tab parameters to exactly whats on the macro ('Gqs 29')see below. Is it possible for me to change this so it works on any spreadsheet and any tab without me having to always rename the tab Gqs 29 before the macro works? ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "'Gqs 29'!R21C2:R65536C8").CreatePivotTable TableDestination:="", TableName _ :="PivotTable2" |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "'" & Activehseet.Name & "'!R21C2:R65536C8").CreatePivotTable TableDestination:="", _ TableName:="PivotTable2" --- HTH Bob Phillips (remove xxx from email address if mailing direct) "Nbiggss" wrote in message ... Hi I have created a simple macro to perform a task to put some data into pivot table. The only problem I have with this is that before I run the macro I will always have to change the Sheet Tab parameters to exactly whats on the macro ('Gqs 29')see below. Is it possible for me to change this so it works on any spreadsheet and any tab without me having to always rename the tab Gqs 29 before the macro works? ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "'Gqs 29'!R21C2:R65536C8").CreatePivotTable TableDestination:="", TableName _ :="PivotTable2" |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sName = Sh.Name
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "'" & sName & "'!R21C2:R65536C8").CreatePivotTable TableDestination:="", TableName _ :="PivotTable2" -- Regards, Tom Ogilvy "Nbiggss" wrote: Hi I have created a simple macro to perform a task to put some data into pivot table. The only problem I have with this is that before I run the macro I will always have to change the Sheet Tab parameters to exactly whats on the macro ('Gqs 29')see below. Is it possible for me to change this so it works on any spreadsheet and any tab without me having to always rename the tab Gqs 29 before the macro works? ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "'Gqs 29'!R21C2:R65536C8").CreatePivotTable TableDestination:="", TableName _ :="PivotTable2" |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
NG wrap-around
sName = Sh.Name ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "'" & sName & "'!R21C2:R65536C8").CreatePivotTable TableDestination:="", _ TableName:="PivotTable2" -- HTH Bob Phillips (remove xxx from email address if mailing direct) "Nbiggss" wrote in message ... Thanks for your reply I have tried your suggestion but I seem to be encountering trouble at the point below TableDestination:="", TableName _ :="PivotTable2" "Tom Ogilvy" wrote: sName = Sh.Name ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "'" & sName & "'!R21C2:R65536C8").CreatePivotTable TableDestination:="", TableName _ :="PivotTable2" -- Regards, Tom Ogilvy "Nbiggss" wrote: Hi I have created a simple macro to perform a task to put some data into pivot table. The only problem I have with this is that before I run the macro I will always have to change the Sheet Tab parameters to exactly whats on the macro ('Gqs 29')see below. Is it possible for me to change this so it works on any spreadsheet and any tab without me having to always rename the tab Gqs 29 before the macro works? ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "'Gqs 29'!R21C2:R65536C8").CreatePivotTable TableDestination:="", TableName _ :="PivotTable2" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |