Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to: Open closed workbook/Search data tables/Return data to open workbook | Excel Discussion (Misc queries) | |||
RETRIEVE DATA FROM ANOTHER WORKBOOK BY CHECKING ON WORKBOOK DATE | Excel Worksheet Functions | |||
1.Open workbook. 2 copy data. 3 replace data. 4 save workbook. | Excel Programming | |||
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook | Excel Programming | |||
Open a password protected excel workbook from second workbook to fetch data using dynamic connection | Excel Programming |