Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RWN RWN is offline
external usenet poster
 
Posts: 104
Default Find the range of a SubTotal

Is it possible to find the range that a SubTotal function refers to?

i.e. cell value is "=SUBTOTAL(9,J25:J31)"

Within the macro I want to determine the range of rows referred to in this cell (25-31).

--
Regards;
Rob
------------------------------------------------------------------------


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Find the range of a SubTotal

As long as you're looking for cells on the same worksheet, you can look at
..precedents.

Option Explicit
Sub testme()

Dim myPrecedents
Dim myCell As Range

Set myCell = ActiveSheet.Range("a1")

With myCell
.Formula = "=SUBTOTAL(9,J25:J31)"
MsgBox .Precedents.Address(0, 0)
End With
End Sub



RWN wrote:

Is it possible to find the range that a SubTotal function refers to?

i.e. cell value is "=SUBTOTAL(9,J25:J31)"

Within the macro I want to determine the range of rows referred to in this cell (25-31).

--
Regards;
Rob
------------------------------------------------------------------------


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
RWN RWN is offline
external usenet poster
 
Posts: 104
Default Find the range of a SubTotal

Thanks Dave;

That put me on the right track - missed a mental connection to "Precedents".
(was extracting from a "FormulaArray" but KNEW there had to be an easier way-if not 30
different ways.)

Turns out that;

Cells(StRow, StCol).Precedents.Select
For Each cl In Selection
' Do the tax exclusion using "Cells(cl.Row, cl.Column)"
Next

Is what I wanted

Again, thanks.
--
Regards;
Rob
------------------------------------------------------------------------


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
To find subtotal - Please help pol Excel Discussion (Misc queries) 8 February 5th 10 10:06 AM
subtotal by a range gls858 New Users to Excel 4 April 7th 09 10:57 PM
Subtotal of Abs of a range? G Lykos Excel Worksheet Functions 3 March 7th 07 07:26 PM
Find, Loop, Subtotal Adresmith[_10_] Excel Programming 1 October 29th 04 10:28 PM
Find, Loop, Subtotal Adresmith[_9_] Excel Programming 1 October 29th 04 09:42 PM


All times are GMT +1. The time now is 04:57 PM.

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"