Solved

Efficient was to copy a formula from within MS Access with a Excel template open

Posted on 2014-12-13
6
223 Views
Last Modified: 2014-12-14
I have the attached template where from within MS Access I will be pasting data from a recordset into the template columns A and B.  What is the most efficient way to copy down the formula in col  d ?  My challenge is I do not know from day to day how many rows I will have to paste from MS Access to Excel.. In addition there is no guarantee I will have information in col c

From within MS Access
.Range("A2").CopyFromRecordset rs   - This copys my data from MS Access into Col A-C

Note the Experts Exchange Attachment facility will not allow me to attach as template so I have attached it below as an Excel spreadsheet.
Test-Template.xlsx
0
Comment
Question by:upobDaPlaya
  • 3
  • 3
6 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40498132
did you look at the sample db here
0
 

Author Comment

by:upobDaPlaya
ID: 40498144
The formula already exists in my template.  Do you think it will be more efficient to copy down the formula that will always exist in the first row.  I can do a record count of my recordset from MS Access and then as an example copy down the formula from d1:d25 ?

The sample db you provided loops thru every single cell and perhaps that is more efficient, but that is what I am trying to determine...

Thus, in my example above I will dump the data from MS Access into Excel Col A-C.  Then I left with col D where I need to paste down the formula...
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40498158
if the formula already exist in the template (.xltx)
it will still be available to the newly opened excel file.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:upobDaPlaya
ID: 40498199
Rey..but it looks like in your db example rather than use the existing formula found  in the first row of my attached tempate you are recreating the formula ?
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40498201
if you are very sure that the number of columns will not change,
* no need to recreate the formula
* copyfromrecordset is enough

the same goes if the number of rows will not change

... you are recreating the formula
the codes I used will handle variations of columns and rows.

got it?
0
 

Author Closing Comment

by:upobDaPlaya
ID: 40499597
Thanks Rey I used a mix of your suggestions along with some suggestion I found while researching...
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question