View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
microsoft[_2_] microsoft[_2_] is offline
external usenet poster
 
Posts: 5
Default Sum Exported data automatically from Access database

Hi

Thanks for your response. As I am a novice at this, kindly confirm where
this code would have to be placed. Should it be placed behind the button
which intiates the export from access to excel

Thanks again

"joel" wrote:

The code below will add a fomula into the worksheet with the total.

Set Sht = activeworksheet
LastRow = Sht.Range("A" & Rows.Count).end(Xlup)
NewRow = LastRow + 1
Sht.Range("A" & NewRow).formula = _
"=SUM(A1:A" & LastRow & ")"




"microsoft" wrote:

Hi

I created an Access database which exports data to Excel. I would like
assistance in creating the required code which would allow me to sum some
selected columns automatically after the data is exported (kindly note that I
do not want any additional columns created to capture the total figure).

Note that the rows from the database may vary hence the excel rows will also
vary. Code to determine the row count would need to be included.

Thanks in advance