Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Is this possible

I have created a macro to update a pivot table from an
excel list. Within the macro I have selected all the data
from the list using ctrl alt end which gives me

DATA!$A$1:$O$18498 within the pivot table wizard.

When I re-run the macro it does not bring the new data
past line 18498. Is there something I can put in place of
18498 so the pivot wizard always reads to the end of the
data. It is also doing the same when giving the range a
name and selecting the name.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Is this possible

Paul,

At the top of your code, put this:

Dim mySht As Worksheet
Set mySht = Worksheets("DATA")


Then, in the code, change the line with the SourceData:= to something along
the lines of

SourceData:= "'" & mysht.Name & "'!" &
mysht.Range("A1").CurrentRegion.Address(, , xlR1C1)

HTH,
Bernie
MS Excel MVP

"Paul" wrote in message
...
I have created a macro to update a pivot table from an
excel list. Within the macro I have selected all the data
from the list using ctrl alt end which gives me

DATA!$A$1:$O$18498 within the pivot table wizard.

When I re-run the macro it does not bring the new data
past line 18498. Is there something I can put in place of
18498 so the pivot wizard always reads to the end of the
data. It is also doing the same when giving the range a
name and selecting the name.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Is this possible

This'll work, too (if currentregion works):

...., sourcedata:=mysht.range("a1").currentregion.addres s(external:=true), ...

Bernie Deitrick wrote:

Paul,

At the top of your code, put this:

Dim mySht As Worksheet
Set mySht = Worksheets("DATA")

Then, in the code, change the line with the SourceData:= to something along
the lines of

SourceData:= "'" & mysht.Name & "'!" &
mysht.Range("A1").CurrentRegion.Address(, , xlR1C1)

HTH,
Bernie
MS Excel MVP

"Paul" wrote in message
...
I have created a macro to update a pivot table from an
excel list. Within the macro I have selected all the data
from the list using ctrl alt end which gives me

DATA!$A$1:$O$18498 within the pivot table wizard.

When I re-run the macro it does not bring the new data
past line 18498. Is there something I can put in place of
18498 so the pivot wizard always reads to the end of the
data. It is also doing the same when giving the range a
name and selecting the name.


--

Dave Peterson

Reply
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



All times are GMT +1. The time now is 09:32 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"