Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Using PivotSelect method to find the top of a range

Hi

I have the following code, which selects the range containing all the labels
of the row field "Combination" in the pivot table "Combinations". It then
sets the value of lngRowStart as the row number of the active cell - this
should be the top (i.e. first) of the labels in this range.

ActiveSheet.PivotTables("Combinations").PivotSelec t "Combination[All]",
xlLabelOnly
lngRowStart = ActiveCell.Row
Do While ActiveCell.Value < ""
lngRowEnd = ActiveCell.Row
ActiveCell.Offset(1, 0).Activate
Loop

The problem is that frequently the top of the range is not selected.
Sometimes the active cell is the bottom (i.e. last) of the labels in the
range, meaning that the lngRowStart is assigned the same value as lngRowEnd
(not ideal in the context of this macro).

Can anyone suggest either an alternative way to get the top and bottom row
numbers of this range, or an alternative argument for the PivotSelect method
to specify that the top cell has to be active in the selection?

Thanks

--
There are 10 types of people in the world - those who understand binary and
those who don't.
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
Set range with Find method jlclyde Excel Discussion (Misc queries) 1 December 3rd 08 05:44 PM
Find method fails in hidden range Rick Hansen Excel Programming 2 April 6th 06 10:54 PM
PivotSelect MCyn Excel Programming 1 March 8th 06 02:46 AM
Pivottable Pivotselect string mo_in_france Excel Programming 2 April 15th 05 09:25 AM
range.find method called into a VBA function (problem) Eros Pedrini Excel Programming 5 November 17th 04 12:34 PM


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