Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel subtotals

Status
Not open for further replies.

Hm786

Programmer
Apr 5, 2001
88
0
0
US
Hi,

I am new in writing macros in excel. I need to write a macro, showing the subtotals per headend in a Total's field for example

HeId TotHH HH
1268 DIG CMTY Yes 0 1 1255501
1268 DIG REG Yes 0 25 1255560

Based on this above data I want to show the total of HH(1+25)in the column of TotHH(instead of 0)per HEId

1269 72 6
1269 72 17

Here I need to show 23 instead of 72

Thank You,
Hamida








 


Hi,

Have you tried using the Data/Subtotal feature?

Skip,
[sub]
[glasses] [red]Be Advised![/red] The Vinyards of Texas have produced a wine with diuretic dimishment and urethric relief...
Pinot More![tongue][/sub]
 
Yes I used the data subtotal feature but I need to show that subtotal in the TotHH field.

Thanks,
Hamida
 

Would you care to elaborate on the reason for mismatching the SUBTOTAL to the column?

Skip,
[sub]
[glasses] [red]Be Advised![/red] The Vinyards of Texas have produced a wine with diuretic dimishment and urethric relief...
Pinot More![tongue][/sub]
 


I still don't know why you want to do this, but if you have too many to do manually...
Code:
Sub MoveSubtotals()
    Dim r As Range
    For Each r In Range([A2], [A2].End(xlDown))
        If Right(r.Value, 5) = "Total" Then
            With r.End(xlToRight)
                .Cut .Offset(0, -1)
            End With
        End If
    Next
End Sub

Skip,
[sub]
[glasses] [red]Be Advised![/red] The Vinyards of Texas have produced a wine with diuretic dimishment and urethric relief...
Pinot More![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top