Variable Subtotal range

J

Jim G

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top