You are right Robert. When user don't mention their excel version. We can not go back to old version unless specified. This code works on both 2007 and 2010.
________________________________________ Thanks & Regards Ashish Jain (Microsoft Certified Application Specialist) (Microsoft Certified Professional) http://www.excelitems.com http://www.openexcel.com ________________________________________ On Nov 24, 8:04 pm, roberto mensa <robb....@gmail.com> wrote: > hi Ashish, > there are some differences in methods between 2003 and 2007 versions. > The method Create of PivotCaches is not present into 2003 version and > replaces the method Add. > regards > r > > 2010/11/24 OpenExcel.com <ashishj...@openexcel.com> > > > > > > > > > HI Raj, > > > You can use the below mention code: > > Focus on arguments and understand them, it's easy, you'll never > > forget. > > > ThisWorkbook.PivotCaches.Create(SourceType:=xlDatabase, _ > > SourceData:="Sheet2!R2C2:R6C6", _ > > Version:=xlPivotTableVersion12).CreatePivotTable _ > > TableDestination:="Sheet2!R12C2", _ > > TableName:="PivotTable1", _ > > DefaultVersion:=xlPivotTableVersion12 > > > i Provide Source Data > > ii Provide Pivot Table version - 12 is for Excel 2007 and 11 is for > > Excel 2003. > > iii Provide Pivot Table Destination > > iv Provide Table Name for future operations and reference > > > These all are the compulsory options. > > Try the code and let us know, if further help required. > > > ________________________________________ > > Thanks & Regards > > Ashish Jain > > (Microsoft Certified Application Specialist) > > (Microsoft Certified Professional) > >http://www.excelitems.com > >http://www.openexcel.com > > ________________________________________ > > > On Nov 24, 2:12 pm, Raj Mahapatra <rajafs...@gmail.com> wrote: > > > hi Group, > > > > Can any one send me the macro commands to create pivot table in excel. > > > > Thanks & Regards > > > > Rajesh > > > -- > > > --------------------------------------------------------------------------- > > ------- > > Some important links for excel users: > > 1. Follow us on TWITTER for tips tricks and links : > >http://twitter.com/exceldailytip > > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310 > > 3. Excel tutorials athttp://www.excel-macros.blogspot.com > > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com > > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com > > > To post to this group, send email to excel-macros@googlegroups.com > > > <><><><><><><><><><><><><><><><><><><><><><> > > Like our page on facebook , Just follow below link > >http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&... -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts