![]() |
vba cell reference
new to VBA.
trying to come up with a line of code that will open a specific worksheet based on value in cell in another workbook. both workbooks are open. -- douglass |
vba cell reference
Workbooks.Open(Workbooks("2ndWorkbook.xls").Sheets ("Sheet1").Range("A1").Value)
will open the workbook which is sitting in A1 of Sheet1 of workbook named 2ndWorkbook.xls HTH "douglass" wrote in message ... new to VBA. trying to come up with a line of code that will open a specific worksheet based on value in cell in another workbook. both workbooks are open. -- douglass |
vba cell reference
Assuming the other book contains the name of the sheet in cell A1 of sheet 1...
sheets(worksbooks("MyBook.xls").Sheets("Sheet1").r ange("A1").value).Select -- HTH... Jim Thomlinson "douglass" wrote: new to VBA. trying to come up with a line of code that will open a specific worksheet based on value in cell in another workbook. both workbooks are open. -- douglass |
vba cell reference
oops -- misread the original. Jim's solution is good (would have been mine!)
"Bob Umlas" wrote in message ... Workbooks.Open(Workbooks("2ndWorkbook.xls").Sheets ("Sheet1").Range("A1").Value) will open the workbook which is sitting in A1 of Sheet1 of workbook named 2ndWorkbook.xls HTH "douglass" wrote in message ... new to VBA. trying to come up with a line of code that will open a specific worksheet based on value in cell in another workbook. both workbooks are open. -- douglass |
vba cell reference
I appreciate the prompt responses to my inquiry. I feel I probably should
explain what I'm trying to do more clearly. I have two open worksheets. The procedure would copy data from the source worksheet then paste that information to the target worksheet. The exact target worksheet name is always in cell c7 of the source worksheet. So, based on that value, it first locates the same sheet number in the target worksheet, then pastes the data. The source worksheet (tab) name keeps changing and does not always match precisely the name in cell c7 of that sheet (which does not change) -- douglass "Bob Umlas" wrote: oops -- misread the original. Jim's solution is good (would have been mine!) "Bob Umlas" wrote in message ... Workbooks.Open(Workbooks("2ndWorkbook.xls").Sheets ("Sheet1").Range("A1").Value) will open the workbook which is sitting in A1 of Sheet1 of workbook named 2ndWorkbook.xls HTH "douglass" wrote in message ... new to VBA. trying to come up with a line of code that will open a specific worksheet based on value in cell in another workbook. both workbooks are open. -- douglass |
All times are GMT +1. The time now is 02:45 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com