ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Best Practice (https://www.excelbanter.com/excel-discussion-misc-queries/96263-best-practice.html)

CWillis

Best Practice
 
I have a macro that loads data from another workbook when a button is pushed.
Currently it only pulls data in from one cell using the following lines of
code:

With Sheet23.Range("A1")
.Formula = "= '" & module1location & "sheet2'!A3"
.Formula = .Value
End With

Shortly, I am going to be pulling in a lot more data from different cells
from "module1location". Is this the best way to be doing this? Seems like I
remember someone saying "don't fix what ain't broke..."

Thanks for any help,
Chris

Jim Rech

Best Practice
 
There are at least 3 ways to get information from one workbook into another.
One is to open the workbook and do a copy/paste. Another is to create
linking formulas (your technique) which works with an open or closed source
workbook. A third is to use ADO if the source data is arranged in a table.
Since my 'best practice' is to waste as little of the user's time as
possible, I'd use the technique that is the quickest in a realistic test.
You'd have to run some time trials to determine that.

--
Jim
"CWillis" wrote in message
...
|I have a macro that loads data from another workbook when a button is
pushed.
| Currently it only pulls data in from one cell using the following lines of
| code:
|
| With Sheet23.Range("A1")
| .Formula = "= '" & module1location & "sheet2'!A3"
| .Formula = .Value
| End With
|
| Shortly, I am going to be pulling in a lot more data from different cells
| from "module1location". Is this the best way to be doing this? Seems
like I
| remember someone saying "don't fix what ain't broke..."
|
| Thanks for any help,
| Chris



CWillis

Best Practice
 
Thanks Jim. My data is just spread out in different cells so I don't think
ADO is the best way to go. I also don't want to open the workbook, so looks
like i'm sticking with my way. Thanks again.

"Jim Rech" wrote:

There are at least 3 ways to get information from one workbook into another.
One is to open the workbook and do a copy/paste. Another is to create
linking formulas (your technique) which works with an open or closed source
workbook. A third is to use ADO if the source data is arranged in a table.
Since my 'best practice' is to waste as little of the user's time as
possible, I'd use the technique that is the quickest in a realistic test.
You'd have to run some time trials to determine that.

--
Jim
"CWillis" wrote in message
...
|I have a macro that loads data from another workbook when a button is
pushed.
| Currently it only pulls data in from one cell using the following lines of
| code:
|
| With Sheet23.Range("A1")
| .Formula = "= '" & module1location & "sheet2'!A3"
| .Formula = .Value
| End With
|
| Shortly, I am going to be pulling in a lot more data from different cells
| from "module1location". Is this the best way to be doing this? Seems
like I
| remember someone saying "don't fix what ain't broke..."
|
| Thanks for any help,
| Chris





All times are GMT +1. The time now is 07:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com