Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default run macro before closing if worksheet name is fixed

Hi All

How can I create macro if worksheet name is ex."Template" before closing
workbook? I use this sheetname in more then ten workbooks

Best regards


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default run macro before closing if worksheet name is fixed

If you are asking how to refer to a worksheet with the same name in several
different workbooks, then you would include the workbook name also:

Workbooks ("MyBook").Worksheets ("Template")
Workbooks ("MyBook2").Worksheets ("Template")
Workbooks ("MyBook3").Worksheets ("Template")
etc...
Mike F
"Jaan" wrote in message
...
Hi All

How can I create macro if worksheet name is ex."Template" before closing
workbook? I use this sheetname in more then ten workbooks

Best regards




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default run macro before closing if worksheet name is fixed


Do you want to check if the activesheet is called "Template" and if it
is close the workbook? if so,
Code:
--------------------
If ActiveWorkbook.ActiveSheet.Name = "Template" Then
ActiveWorkbook.Close False
End If
--------------------
Jaan;478879 Wrote:
Hi All

How can I create macro if worksheet name is ex."Template" before
closing
workbook? I use this sheetname in more then ten workbooks

Best regards



--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=132083

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default run macro before closing if worksheet name is fixed

Hi Simon
I want to check all my workbooks. If the workbook what i will close contain
sheet "Template", then must run "MyMacro".The Mike solution is not this what
I want, because I create severel workbooks every day with worksheet
"Template".
As many I get the picture, this solution need rewrite macro each time I will
create new workbook

Best regards


"Simon Lloyd" kirjutas:


Do you want to check if the activesheet is called "Template" and if it
is close the workbook? if so,
Code:
--------------------
If ActiveWorkbook.ActiveSheet.Name = "Template" Then
ActiveWorkbook.Close False
End If
--------------------
Jaan;478879 Wrote:
Hi All

How can I create macro if worksheet name is ex."Template" before
closing
workbook? I use this sheetname in more then ten workbooks

Best regards



--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=132083


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
How can I make fixed a reference to a worksheet? Consu Excel Discussion (Misc queries) 1 November 11th 08 11:55 AM
Copying fixed cell value from different worksheets to new worksheet [email protected] Excel Discussion (Misc queries) 0 January 29th 07 07:54 PM
Fixed decimals worksheet specific Charlotte Excel Worksheet Functions 7 September 14th 06 02:33 PM
macro closing worksheet Jeff Excel Discussion (Misc queries) 1 July 3rd 06 01:58 PM
How do I force Excel to use fixed cells on a different worksheet? Craig Spencer UK New Users to Excel 1 May 5th 05 04:49 PM


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