View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Richard Buttrey
 
Posts: n/a
Default activate macro only in sheet2

On Mon, 20 Mar 2006 14:40:46 -0600, Narkom
wrote:


How do I activte a macro only for sheet2?


If Sheet2 is the Active Sheet when the macro runs, then wrap your
macro code in an IF..Then test

If ActiveSheet.Name="Sheet2 Then
YourCode...
End If

If you are looping through various sheets without them becoming
active, then the same logic applies, just test for the sheet name at
the start of your code.


HTH
__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________