Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default SpecialCells and UsedRange

I am using a pivot table that starts on row 5. A macro
needs to know the bottom row of the pivot table, so I used
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row.

I'm finding a problem when we filter the pivot table - say
from 2000 rows to 10 rows - the SpecialCells variable
still gives 2000 rows. But if I access UsedRange, then
SpecialCells gets updated to the correct value of 10.

Any ideas why SpecialCells(xlCellTypeLastCell) does not
update correctly?

Thanks!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default SpecialCells and UsedRange

Hi Norm,

Excel's used range reflects the last cell that has been used since it was
last reset. Used includes formatting etc.

Probably better to use something like range("a65536").end(xlup) to find
the last nonblank cell in column A.

Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com/FxlV2WhatsNew.htm

"Norm" wrote in message
...
I am using a pivot table that starts on row 5. A macro
needs to know the bottom row of the pivot table, so I used
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row.

I'm finding a problem when we filter the pivot table - say
from 2000 rows to 10 rows - the SpecialCells variable
still gives 2000 rows. But if I access UsedRange, then
SpecialCells gets updated to the correct value of 10.

Any ideas why SpecialCells(xlCellTypeLastCell) does not
update correctly?

Thanks!!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default SpecialCells and UsedRange

activesheet.UsedRange

will usually reset it. (tell excel to reevaluate what cells it needs to keep
track of) (and as you have apparently discovered)

It doesn't update until you take an action to update it. UsedRange works
exactly as it should. It just doesn't match your expectations. Except for
the bug that existed in the original release of xl2000, it acurately
reflects the extent of the cells Excel is maintaining information on.
That is the definition of usedrange - not the size of your pivottable.


--
Regards,
Tom Ogilvy



"Norm" wrote in message
...
I am using a pivot table that starts on row 5. A macro
needs to know the bottom row of the pivot table, so I used
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row.

I'm finding a problem when we filter the pivot table - say
from 2000 rows to 10 rows - the SpecialCells variable
still gives 2000 rows. But if I access UsedRange, then
SpecialCells gets updated to the correct value of 10.

Any ideas why SpecialCells(xlCellTypeLastCell) does not
update correctly?

Thanks!!



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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Specialcells Bruno Uato Charts and Charting in Excel 0 October 7th 05 07:42 PM
SpecialCells(xlCellTypeFormulas) Kevin Gabbert Excel Programming 1 January 28th 04 05:06 PM
AutoFilter /specialcells Ron de Bruin Excel Programming 8 January 13th 04 03:45 PM
specialcells(xlcelltypeblanks) Neil[_11_] Excel Programming 5 October 9th 03 10:11 AM
Usedrange Terry VanDuzee Excel Programming 6 August 10th 03 05:57 PM


All times are GMT +1. The time now is 11:38 PM.

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

About Us

"It's about Microsoft Excel"