Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Using a macro to open an existing workbook

I have a jobs list in a work book named Jobs & Jobs Sheets in a folder called
Job Sheets.
I want to select a job in Jobs & run a macro that opens the job sheet that
has the name in the activecell.
If the job sheet does not exist then I want a job sheet created from a
template in the the job sheet folder.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Using a macro to open an existing workbook

Dim sh As Worksheet
Dim mpName As String

On Error Resume Next
Set sh = Worksheets(ActiveCell.Value)
On Error GoTo 0
If sh Is Nothing Then
mpName = ActiveCell.Value
Set sh = Worksheets.Add
sh.Name = mpName
End If
sh.Activate

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"chrism" wrote in message
...
I have a jobs list in a work book named Jobs & Jobs Sheets in a folder
called
Job Sheets.
I want to select a job in Jobs & run a macro that opens the job sheet that
has the name in the activecell.
If the job sheet does not exist then I want a job sheet created from a
template in the the job sheet folder.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Using a macro to open an existing workbook

Thanks Bob, That works but I should have said the jobsheet is actually a
workbook so I will fiddle with your code to make it open or create a
workbook. I'll let you know how I go
Chris marwick NZ

"Bob Phillips" wrote:

Dim sh As Worksheet
Dim mpName As String

On Error Resume Next
Set sh = Worksheets(ActiveCell.Value)
On Error GoTo 0
If sh Is Nothing Then
mpName = ActiveCell.Value
Set sh = Worksheets.Add
sh.Name = mpName
End If
sh.Activate

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"chrism" wrote in message
...
I have a jobs list in a work book named Jobs & Jobs Sheets in a folder
called
Job Sheets.
I want to select a job in Jobs & run a macro that opens the job sheet that
has the name in the activecell.
If the job sheet does not exist then I want a job sheet created from a
template in the the job sheet folder.




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
export data to an existing and open workbook without knowing the f vernington Excel Programming 8 June 28th 07 03:38 AM
Open workbook in existing Excel session mnehlig Excel Programming 5 June 5th 06 03:42 AM
Blank workbook opens when try to open any existing book poloboyUK Excel Discussion (Misc queries) 2 February 2nd 06 08:35 PM
Open an existing workbook and reference it TimT Excel Programming 1 October 12th 05 05:11 PM
Open existing workbook Daniel Van Eygen Excel Programming 4 August 25th 04 02:47 PM


All times are GMT +1. The time now is 05:29 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"