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

Hi

What value shows for lastrow?

--
Regards

Roger Govier


"houghi" wrote in message
...

I get a 'Runtime error 1004'. Reference is not valid. With 'debug' the
whole line is yellow. When I change
!Range(Cells(2,1),cells(lastrow,5))
back to !R2C1:R37C5 then it works again.

Could it be that this not work because I work with Excel 2000? If that
is the case, is there a different solution?

Roger Govier wrote:
Hi

you could insert some code to find the lastrow

Dim lastrow as long
Lastrow = Cells(Rows.Count, 1).End(xlUp).row

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:=
_
"'Y:\\[Report.XLS]Sheet1'!Range(Cells(2,1),cells(lastrow,5))
_
).CreatePivotTable TableDestination:=Range("A4"),
TableName:="PivotTable1"



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 03:03 AM.

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"