Thread: Subtotal
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Subtotal

What are you trying to do??? You have declared X as long. Then you try to
assign it to the Subtotal Method of the range. What number were you thinking
would end up in X since subtotal adds subtotals to a range of values???
--
HTH...

Jim Thomlinson


"treasuresflemar" wrote:

Why won't this or any other way I have tried to write this line work?

Set x = rng.Subtotal(groupby:=1, Function:=xlSum)

Argument not optional error

Dim x as long

With Range(rn) 'tells range to use

rc = .Find(DateValue(dt), LookIn:=xlValues,
_lookat:=xlWhole).Rows.Row
'get row number of match

rng = ("b" & rc & ":" & "l" & rc)
'sets range to subtotal

Set x = rng.Subtotal(groupby:=1, Function:=xlSum)


End With