Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default open worksheet

Is there a way to open a specific worksheet based on the contents of a cell
in the source worksheet..

Workbooks.Open Filename:="C:\filename.xls#(worksheet name in A1)!A1"

TIA

Ben
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default open worksheet

Here is some code for you to try. You jsut need to get the workbook and sheet
names added in

Sub OpenToSheet()
Dim wbk As Workbook

Workbooks.Open ("C:\ThisBook.xls")
Set wbk = ActiveWorkbook
wbk.Sheets("Sheet1").Select
MsgBox "Here we are"
ThisWorkbook.Activate
MsgBox "And now we are back..."
End Sub
--
HTH...

Jim Thomlinson


"Benjamin" wrote:

Is there a way to open a specific worksheet based on the contents of a cell
in the source worksheet..

Workbooks.Open Filename:="C:\filename.xls#(worksheet name in A1)!A1"

TIA

Ben

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default open worksheet

Thanks. But say I don't want to type in the name of the worksheet, but refer
to it's name which is stored in cell A1.

"Jim Thomlinson" wrote:

Here is some code for you to try. You jsut need to get the workbook and sheet
names added in

Sub OpenToSheet()
Dim wbk As Workbook

Workbooks.Open ("C:\ThisBook.xls")
Set wbk = ActiveWorkbook
wbk.Sheets("Sheet1").Select
MsgBox "Here we are"
ThisWorkbook.Activate
MsgBox "And now we are back..."
End Sub
--
HTH...

Jim Thomlinson


"Benjamin" wrote:

Is there a way to open a specific worksheet based on the contents of a cell
in the source worksheet..

Workbooks.Open Filename:="C:\filename.xls#(worksheet name in A1)!A1"

TIA

Ben

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default open worksheet

option explicit
sub testme01()

dim wkbk as workbook
dim wksName as string

wksname = activesheet.range("a1").value

set wkbk = workbooks.open(filename:=c:\filename.xls")

on error resume next
application.goto wkbk.worksheets(wksname).range("a1"), scroll:=true
if err.number < 0 then
beep
err.clear
end if

end sub



Benjamin wrote:

Is there a way to open a specific worksheet based on the contents of a cell
in the source worksheet..

Workbooks.Open Filename:="C:\filename.xls#(worksheet name in A1)!A1"

TIA

Ben


--

Dave Peterson
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
Excel 2007, Automatically open new worksheet on open. jkmyoung Excel Discussion (Misc queries) 4 March 29th 10 04:36 PM
My desktop worksheet shortcut will not open the Excel Worksheet Steve09 Excel Discussion (Misc queries) 2 September 17th 09 04:33 PM
How do I get a blank worksheet to open up when I open Excel? Art@ISCO Setting up and Configuration of Excel 0 July 17th 07 01:30 PM
'Save current worksheet'; 'Open next worksheet' - two command buttons englishmustard Excel Discussion (Misc queries) 1 April 7th 06 12:54 PM
How do I get my personal macro worksheet to open whenever I open . Claudia_R Excel Discussion (Misc queries) 3 December 9th 04 11:59 PM


All times are GMT +1. The time now is 08:40 PM.

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"