Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default Variable Subtotal range

If I have Subtotal Categories in Col A (EG: Total Plant Costs, Total Hire
Costs etc-up to 20 over several hundred rows of data and 12 months in
columns). Each project subtotal will have a different range.

How do I subtotal a column based on a change in subtotal category?

I use the following code to find the current month column based on the data
date and will need to subtotal adjustments one column to the right for each
category change:

Sub FindCurMonthM324()

Dim CurLocation As Range
Dim addr As String
Dim curDate As String
Dim rng As Range

Application.ScreenUpdating = False

curDate = Sheets("Control").Range("B1").Value
Sheets("CheopsM324").Rows(10).NumberFormat = "general"

On Error Resume Next
Set CurLocation = Rows(10).Find(What:=curDate, LookIn:=xlValues)
Set rng = Range(CurLocation.Address)
Debug.Print (rng.Address)

Application.ScreenUpdating = True
If Not CurLocation Is Nothing Then
addr = CurLocation.Address
CurLocation.Offset(3, 0).Select
Else
MsgBox "Period Date Not Found"
End If

Sheets("CheopsM324").Rows(10).NumberFormat = "mmm-yy"

End Sub



--
Jim
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
Please help - subtotal using vlookup depending on variable month robstton Excel Discussion (Misc queries) 2 February 5th 09 12:27 AM
Subtotal variable range JDaywalt Excel Worksheet Functions 1 May 20th 08 07:26 PM
Subtotal of Abs of a range? G Lykos Excel Worksheet Functions 3 March 7th 07 07:26 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


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