View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Deville Deville is offline
external usenet poster
 
Posts: 3
Default Subtotalling a column of data?


The 1st time I tried this way it worked. But now I get an
error almost every other time I run this.
Run-time error '1004': Method '~' of object '~' failed
Would anyone happen to know how to code this in Ms Access
VBA referencing the Excel Object.
-----Original Message-----
Dim rng as Range
Dim icol as 5 ' column E as an example.
icol = 5
set rng = Range(cells(3,icol),Cells(rows.count,icol).End

(xlup))

rng(1).offset(rng.rows.count) = "=Sum(" & rng.Address

& ")"


Change the 1 to the column where you want to do the

subtotal.

--
Regards,
Tom Oglivy


"Deville" wrote in

message
...
Hello all,
I am going from Ms Access to Ms Excel. Using VBA I
create the spreadsheet and create a header section.

Next I
dump the data into the sheet using Copyrecordset. My
question is how can I do a subtotal of a column

starting a
row 3 until the last cell containing data. Also, the
subtotal cell needs to 1 below the last cell containng
data.

Thnx



.