PC Review


Reply
Thread Tools Rate Thread

code 'summing' - access query creating an excel-sheet

 
 
Gerry
Guest
Posts: n/a
 
      24th Feb 2010
Hello,
I created an excel sheet by code, based on an access query.
For one of these collumns I have to make a sum of this collumn and put
the result at the bottom of that collumn (the amount of rows varies
with every launch of the query). I don't know how to do it in code.
Can someone help me with this? When I register a macro in excel which
does this, I encounter that I cannot fit it properly into my code in
access. Can someone help me with this piece of code?

 
Reply With Quote
 
 
 
 
Pendragon
Guest
Posts: n/a
 
      24th Feb 2010
Are you creating a brand new excel spreadsheet each time you execute the code?

I did something similar but found I had to write data to a template
spreadsheet using CopyFromRecordset. In the template, I created a Sum
function in the appropriate column and wrote the data above that cell. The
sum function range automatically adjusts to your recordset.

Example:

Cell A1 - Header
Cell A2 - Blank -- use CopyFromRecordset and write to this cell
Cell A3 - Sum function


"Gerry" wrote:

> Hello,
> I created an excel sheet by code, based on an access query.
> For one of these collumns I have to make a sum of this collumn and put
> the result at the bottom of that collumn (the amount of rows varies
> with every launch of the query). I don't know how to do it in code.
> Can someone help me with this? When I register a macro in excel which
> does this, I encounter that I cannot fit it properly into my code in
> access. Can someone help me with this piece of code?
>
> .
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How insert rows in Excel sheet from Access VBA code =?Utf-8?B?Um9iZXJ0byBDYXJhYmFqYWw=?= Microsoft Access External Data 1 18th Oct 2007 09:23 PM
Exporting Access Table to Excel spread sheet in code still shows headers (Access 2000) Rocky Microsoft Access External Data 5 24th Jun 2005 08:54 PM
opening excel sheet in access VBA code dave Microsoft Access Form Coding 1 1st Mar 2005 06:06 AM
linking excel sheet to access using code Charles Microsoft Excel Programming 0 30th Jan 2004 07:24 AM
Creating an Excel Sheet from an Access Ap. Salvador M Microsoft Access VBA Modules 4 4th Sep 2003 02:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:26 AM.