LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Using VBA to read/write data from Excel files

Create a new worksheet in the receiving workbook.
Open your sending file.
Select the cell in the sending worksheet in the sending workbook.
Edit|Copy (or ctrl-c)

Back to A1 of that new worksheet in the receiving workbook.
Edit|paste special|paste link

Close the sending workbook.

Now back to the receiving workbook.

Start recording a macro.
Select A1 of that new sheet
Hit F2 (to edit the cell)
Hit Enter (don't make any changes)
Stop recording the macro.

Your recorded macro will have the syntax building that formula. Depending on
the names of the paths/folders/workbooks/worksheets and addresses, you'll want
to match that syntax when you build the formula using variables.

If you have trouble, share the exact recorded formula and your variable names
and what they represent.

Robert Crandal wrote:

Can you give an example of adding "formulas to empty cells to retrieve
values from
your sending workbook"???

Additionally, I discovered that the GetValue() function mentioned below DOES
work very well for reading individual cells. However, if I want to read a
range
of cells (say "A1:L25") then my code starts to look ugly. It is also a very
slow process of reading a range of cells one cell at a time by calling
GetValue() for each individual cell. Can GetValue somehow be used to
read a range of cells in a faster manner???

As for the GetDataFromClosedFile() function, it seems to be missing function
parameters, so I have no clue how to use that one.

Hope to hear from you soon! Thank you!

"Dave Peterson" wrote in message
...

You could add formulas to empty cells to retrieve values from your sending
workbook.

=======

John Walkenbach has a routine that can get values from a closed workbook:
http://j-walk.com/ss/excel/eee/eee009.txt
Look for either: GetDataFromClosedFile or GetValue.

=======


--

Dave Peterson
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving Excel files to Read/Write only folders vteventrider Excel Discussion (Misc queries) 1 September 5th 07 08:31 PM
Read/edit/write from/to files David Excel Programming 3 May 11th 06 03:11 PM
Sharing read-write Excel 2003 files ttt8262 Excel Discussion (Misc queries) 0 April 1st 06 09:39 PM
How to read a SQL Table into Excel change the data and write back into SQL Belinda Excel Programming 1 June 10th 04 10:18 AM
Read/Write data to/from text files from a spreadsheet. lothario[_37_] Excel Programming 8 November 2nd 03 03:10 PM


All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"