View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sandy-V[_2_] Sandy-V[_2_] is offline
external usenet poster
 
Posts: 5
Default False UsedRange in hidden columns

I've inherited a worksheet that has hidden columns & rows
to the right and below the visible area of 60 rows x 10
col's, size of a printable page.

My code loops each cell in the UsedRange, only 600 cells
so should be quick. However the Usedrange count is 226816
cells (886 x 256), and very slow.

If I unhide rows & columns, Usedrange.count decreases to
15360 (60 x 256). So, simply by unhiding, UsedRange in
code can now reset the Usedrange to exclude rows 61 to
886, but not columns 11 to 256. Actually I'm not even
sure it's my code resetting, if I goto LastCell before
running any code it selects R60C256.

If I now save it in unhidden state and reopen,
Usedrange.count then correctly reports 600, indicating
there had not been any leftover formats etc in the
previously hidden columns.

So, is there any way I can fully reset the Usedrange but
without unhiding R's & C's, saving and reopening the WB.

TIA,
Sandy