getting data from another workbook
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
|