#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 320
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 320
Default 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





  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default 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






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
Changing sheet reference to cell reference TeeJay Excel Worksheet Functions 3 October 19th 07 11:50 AM
Formulas that reference cells that reference another cell Andrea Excel Discussion (Misc queries) 7 October 19th 06 08:14 AM
absolute cell reference A spreadsheet cell reference that does no help Excel Discussion (Misc queries) 1 January 18th 06 06:56 PM
problem with cell reference in =sum(offset(cell reference,x,y,z,a)). Want cell ref to be variable. [email protected] Excel Worksheet Functions 2 December 11th 04 12:05 AM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM


All times are GMT +1. The time now is 05:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"