Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I make fixed a reference to a worksheet? | Excel Discussion (Misc queries) | |||
Copying fixed cell value from different worksheets to new worksheet | Excel Discussion (Misc queries) | |||
Fixed decimals worksheet specific | Excel Worksheet Functions | |||
macro closing worksheet | Excel Discussion (Misc queries) | |||
How do I force Excel to use fixed cells on a different worksheet? | New Users to Excel |