LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Can anybody help to fix this please ?

Hi All,

The following code is supposed to build an array from 8 to 105
(columns i want to subtotal) and then use that array in the subtotal
function.

I think the problem lies with the data type in that the array is built
as a string.

Can anybody help to fix this code please ?


Sub SP_SubTotals()

Dim myCols As Variant
Application.ScreenUpdating = False
Sheets("Staff Planner").Activate
myCols = 8
For i = 9 To LC
myCols = myCols & "," & i
Next i
MsgBox (myCols)
If IsArray(myCols) Then
MsgBox ("OK")
Range(Cells(3, 1), Cells(LR, LC)).Select
Selection.Subtotal GroupBy:=4, Function:=xlSum, TotalList:=myCols,
_
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
End If

End Sub

TIA

Regards

Michael Beckinsale

 
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



All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"