Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
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
Create a new worksheet with a macro and giving it a specific name Steve Krieger Excel Discussion (Misc queries) 2 May 27th 09 10:18 PM
How to run specific macro on selected worksheet? Harshad[_2_] Excel Discussion (Misc queries) 2 October 31st 08 06:56 AM
make a macro 'worksheet specific' Lori Excel Discussion (Misc queries) 11 October 29th 07 12:38 AM
Help with a macro to open to a specific worksheet EAHRENS Excel Worksheet Functions 0 November 30th 05 08:36 PM
Macro avoiding circular reference Kanga 85 Excel Worksheet Functions 3 June 15th 05 03:04 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"