![]() |
Avoiding the worksheet specific name in a macro
Hi All,
Excel 2007. I have a sort and format macro that I use in similar worksheets with different names. I don't know how to tell the macro to not to include the sheet name. Any help is greatly appreciated. Jeff. EggHeadCafe - Software Developer Portal of Choice WPF And The Model View View Model Pattern http://www.eggheadcafe.com/tutorials...l-view-vi.aspx |
Avoiding the worksheet specific name in a macro
If Activesheet is use in place of Sheets("Sheet1") then your code will
operate on the active sheet. If the code is in a standard code module and the reference to a sheet is omitted then the code will operate on the active sheet by default. If you would like to post your code we can give you a hand making it generic. -- HTH... Jim Thomlinson "Jeff Modares" wrote: Hi All, Excel 2007. I have a sort and format macro that I use in similar worksheets with different names. I don't know how to tell the macro to not to include the sheet name. Any help is greatly appreciated. Jeff. EggHeadCafe - Software Developer Portal of Choice WPF And The Model View View Model Pattern http://www.eggheadcafe.com/tutorials...l-view-vi.aspx |
Avoiding the worksheet specific name in a macro
Without knowing what your code looks like, maybe you can just refer to the
activesheet instead of referring to a sheet by its name: With activesheet .range("A1").value = "hi there" .range("x9:z99").clearcontents end with Jeff, Modares wrote: Hi All, Excel 2007. I have a sort and format macro that I use in similar worksheets with different names. I don't know how to tell the macro to not to include the sheet name. Any help is greatly appreciated. Jeff. EggHeadCafe - Software Developer Portal of Choice WPF And The Model View View Model Pattern http://www.eggheadcafe.com/tutorials...l-view-vi.aspx -- Dave Peterson |
All times are GMT +1. The time now is 06:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com