vba cell reference

  • Thread starter Thread starter douglass
  • Start date Start date
D

douglass

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.
 
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
 
Assuming the other book contains the name of the sheet in cell A1 of sheet 1...

sheets(worksbooks("MyBook.xls").Sheets("Sheet1").range("A1").value).Select
 
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)
 
Back
Top