J
jacqui
I am using UsedRange to define my range for the subtotals
method, my code is as follows
Dim arr() As Integer
Dim i As Integer
Dim colArray As Variant
Application.StatusBar = "Inserting Sub Totals - Continuing
and Disc values"
Sheets("data").Select
firstcol = 9
LastCol = Range("IV1").End(xlToLeft).Column
ReDim arr(firstcol To LastCol)
For i = firstcol To LastCol
arr(i) = i
Next
colArray = arr()
With ActiveSheet
.UsedRange.Subtotal groupby:=1, Function:=xlSum,
totallist:=colArray, _
Replace:=True
.UsedRange.Subtotal groupby:=4, Function:=xlSum,
totallist:=colArray, _
Replace:=False
End With
Activesheet.UsedRange.select
With Selection
.ClearOutline
.Copy
.PasteSpecial Paste:=xlValues
End With
etc
However, the ClearOutline method does not remove all of my
showlevel buttons because the Grand Totals are outside of
the range. Can anyone kindly explain why this is
happening and how I can resolve this. Note, I have tried
defining a range called "data" based on cells.select
instead of UsedRange but this took forever to process
because the range was looking at every cell on the
worksheet.
Many thanks
Jacqui
method, my code is as follows
Dim arr() As Integer
Dim i As Integer
Dim colArray As Variant
Application.StatusBar = "Inserting Sub Totals - Continuing
and Disc values"
Sheets("data").Select
firstcol = 9
LastCol = Range("IV1").End(xlToLeft).Column
ReDim arr(firstcol To LastCol)
For i = firstcol To LastCol
arr(i) = i
Next
colArray = arr()
With ActiveSheet
.UsedRange.Subtotal groupby:=1, Function:=xlSum,
totallist:=colArray, _
Replace:=True
.UsedRange.Subtotal groupby:=4, Function:=xlSum,
totallist:=colArray, _
Replace:=False
End With
Activesheet.UsedRange.select
With Selection
.ClearOutline
.Copy
.PasteSpecial Paste:=xlValues
End With
etc
However, the ClearOutline method does not remove all of my
showlevel buttons because the Grand Totals are outside of
the range. Can anyone kindly explain why this is
happening and how I can resolve this. Note, I have tried
defining a range called "data" based on cells.select
instead of UsedRange but this took forever to process
because the range was looking at every cell on the
worksheet.
Many thanks
Jacqui