![]() |
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. |
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. |
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. |
All times are GMT +1. The time now is 05:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com