Subtotals problem - wierd!

M

michael.beckinsale

Hi All,

Below is the code l am using to apply subtotals & then subtotals to
the subtotals. It works fine on the machine l have developed it on but
when l use the workbook on another machine it gives different results!
Both work without any errors but as l say different result. Both
machines are using Windows XP SP2 and Excel 2003 SP2.

I have noticed that on the development machine l only have 4 outline
levels whereas on the 'new' machine l have 5.

Anybody got any ideas?

Note: LC is a function used to determine the Last Column

Sub SKILLS_SubTotals()

Dim myCols As Variant 'Location of array
Dim SC As Integer '1st column to apply subtotals

Application.ScreenUpdating = False
Sheets("Staff Planner").Activate
'---------------
'Build the array
'---------------
'....determine start column
SC = 8
'....build
ReDim myCols(SC To LC)
For i = LBound(myCols) To LC
myCols(i) = i
Next i
'--------------------------------------------------
'Select range & apply subtotals to the myCols array
'--------------------------------------------------
If IsArray(myCols) Then
Range(Cells(3, 1), Cells(LR, LC)).Select
Selection.Subtotal GroupBy:=2, Function:=xlSum,
TotalList:=Array(myCols), _
Replace:=True, PageBreaks:=False,
SummaryBelowData:=True
Range(Cells(3, 1), Cells(LR, LC)).Select
Selection.Subtotal GroupBy:=4, Function:=xlSum,
TotalList:=Array(myCols), _
Replace:=False, PageBreaks:=False,
SummaryBelowData:=True
End If

End Sub

Regards

Michael B
 

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