ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Running a macro in several worksheets (https://www.excelbanter.com/excel-discussion-misc-queries/203590-running-macro-several-worksheets.html)

Lisa

Running a macro in several worksheets
 
I have a workbook that will be used by several people. I need them to be
able to copy a worksheet and use the macros placed on there for the new
worksheet. I am finding that when I copy my first worksheet, and attempt to
run the macro on sheet2, it goes back to sheet1.

1 macro is written as follows:

Sub Shelving()
'
' Shelving Macro
'

'
ActiveWorkbook.CustomViews("Shelving").Show
End Sub



What do I need to change in order to have this work on the new sheet?

Jim Thomlinson

Running a macro in several worksheets
 
Custom views format a specific representation of a specific sheet. When you
switch to that view you switch to that sheet by default. Custom views can not
be use to format different sheets.
--
HTH...

Jim Thomlinson


"Lisa" wrote:

I have a workbook that will be used by several people. I need them to be
able to copy a worksheet and use the macros placed on there for the new
worksheet. I am finding that when I copy my first worksheet, and attempt to
run the macro on sheet2, it goes back to sheet1.

1 macro is written as follows:

Sub Shelving()
'
' Shelving Macro
'

'
ActiveWorkbook.CustomViews("Shelving").Show
End Sub



What do I need to change in order to have this work on the new sheet?



All times are GMT +1. The time now is 11:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com