Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default getting data from another workbook

You are writing down that the filename is a constant in the code, as in
ReadFromFilename.xls. I am trying to obtain the filename from the user than
I store that filename in the range "ReadFromFilename". Then I am trying to
use this filename from that range in determining the filename to read from.

The user click on a button which opens a file open dialog box, I obtain the
name from that. This filename I then put into the range ReadFromFilename.
I then use this name to determine which file the user wants me to obtain
values from. I also obtain the WriteToFilename so that I can grab data from
a newer version of my program. I am trying to make it easier for users of
my program to migrate from an earlier version to a newer version of my
program.

I hope this clears things up for you.

Dave Marden


"Martin Fishlock" wrote in message
...
Dave

Assuming that the workbooks are open:

Private Sub cmdRead_Click()

Workbooks("Data Gatherer For Scoreboard.xls" _
).Worksheets("Sheet1").Range("Handicap") = _
Workbooks("ReadFromFilename.xls").Worksheets( _
"Competitors A-Z").Range("D29")
End Sub

Private Sub cmdWrite_Click()
Workbooks("WriteToFilename.xls" _
).Worksheets("Competitors A-Z").Range("D29") = _
Workbooks("Data Gatherer For Scoreboard.xls" _
).Worksheets("Sheet1").Range("Handicap")

End Sub

But...I think that you are making a it more difficult than it should be.

I'm a little unsure on what you are doing at the start and maybe this will
work but not sure.

Workbooks("Data Gatherer For Scoreboard.xls" _
).Worksheets("Sheet1").Range("Handicap")

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Dave Marden" wrote:

Actually what I am trying to do is a little deaper than this.

Spreadsheet name that is the data handler = Data Gatherer For
Scoreboard.xls
Sheet Name = Sheet1
Range Name = Handicap

Spreadsheet Data is supposed to be coming from = ReadFromFilename
Sheet Name = Competitors A-Z
Range = D29

Spreadsheet Data is supposed to be going to = WriteToFilename
Sheet Name = Competitors A-Z
Range = D29

The Following is the code I worked out using your suggestions. The Data
Gatherer spreadsheet is getting the file path, name, and extension. This
is
put into a cell with the name of ReadFromFilename. I would think this
should work but I am getting a ("Runtime Error 9" Subscript out of range
error). Could anyone help me out with what is wrong with my sytanx? I
would assume it is the part where I write
"Workbooks(Range("ReadFromFilename").Text)" but I would think this should
work.

Private Sub cmdRead_Click()
Workbooks("Data Gatherer For
Scoreboard.xls").Worksheets("Sheet1").Range("Handi cap") =
Workbooks(Range("ReadFromFilename").Text).Workshee ts("Competitors
A-Z").Range("D29")
End Sub

Private Sub cmdWrite_Click()
Workbooks(Range("WriteToFilename").Text).Worksheet s("Competitors
A-Z").Range("D29") = Workbooks("Data Gatherer For
Scoreboard.xls").Worksheets("Sheet1").Range("Handi cap")
End Sub


Any Help Would Be Appreciated,
Dave Marden





Reply
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
How to: Open closed workbook/Search data tables/Return data to open workbook Hugh Adams Excel Discussion (Misc queries) 0 August 18th 10 02:04 PM
RETRIEVE DATA FROM ANOTHER WORKBOOK BY CHECKING ON WORKBOOK DATE Joe Excel Worksheet Functions 13 May 27th 08 01:52 AM
1.Open workbook. 2 copy data. 3 replace data. 4 save workbook. Cristobalitotom Excel Programming 0 July 6th 06 12:24 AM
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook burl_rfc Excel Programming 1 April 1st 06 08:48 PM
Open a password protected excel workbook from second workbook to fetch data using dynamic connection kaustav choudhury Excel Programming 2 April 3rd 04 06:18 AM


All times are GMT +1. The time now is 01:19 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"