LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 56
Default Pivot and VB scripting range problem

Hello,

If this is not the correct group, please let me know which one is.

I am pretty new to Excel scripting. I am able to do what I need most of
the time.

My problem is that I want to place a pivot table in a scriptand that
works, but the
data range is never the same. I have recorded a macro an that works
for said data. It gives me the following:


ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"'Y:\\[Report.XLS]Sheet1'!R2C1:R37C5" _
).CreatePivotTable TableDestination:=Range("A4"), TableName:="PivotTable1"

However the range can go from R2C1:R3C5 to R2C1:R7000C5 and will be
different almost each time.

I have tried to take a range that is way too big, but then the Pivot
table gives me the wrong results.
So what is the best way to select the correct range each time?

I have searched with Google for a few days, but came up with nothing.
:-(

I am working with Excel 2000. Sorry, no option in updating or upgrading.
Company policy.

houghi
--
Knock-knock.
Who's there?
Under the Patriot Act, we don't have to tell you that.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripting in Excel 2007 Tinsel Excel Discussion (Misc queries) 1 February 12th 07 10:42 AM
Scripting from command line [email protected] Excel Discussion (Misc queries) 0 January 24th 07 04:29 PM
Scripting Question Becca Setting up and Configuration of Excel 2 September 22nd 05 12:33 AM
Excel scripting,programming TechGuyatwork New Users to Excel 2 June 19th 05 06:53 PM
Scripting.FileSystemObject Leif Rasmussen Excel Discussion (Misc queries) 1 January 12th 05 11:21 PM


All times are GMT +1. The time now is 08:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"