How do I activte a macro only for sheet2?--
Narkom
------------------------------------------------------------------------
Narkom's Profile: www.excelforum.com/member.php...oamp;userid=32642
View this thread: www.excelforum.com/showthread...hreadid=524554I don't know how you want to activate the macro, but if you want it to work
only on Sheet2, use a line something like:
If ActiveSheet.Namelt;gt;quot;Sheet2quot; Then Exit Sub
If you want it to work with only Sheet2 whether or not it is the active
sheet use something like:
With Sheets(quot;Sheet2quot;)
'Your code goes here
End With
HTH Otto
quot;Narkomquot; gt; wrote in
message ...
gt;
gt; How do I activte a macro only for sheet2?
gt;
gt;
gt; --
gt; Narkom
gt; ------------------------------------------------------------------------
gt; Narkom's Profile:
gt; www.excelforum.com/member.php...oamp;userid=32642
gt; View this thread: www.excelforum.com/showthread...hreadid=524554
gt;
On Mon, 20 Mar 2006 14:40:46 -0600, Narkom
gt; wrote:
gt;
gt;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=quot;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
__________________________
That was it!
Finally i got some light
Thank you both--
Narkom
------------------------------------------------------------------------
Narkom's Profile: www.excelforum.com/member.php...oamp;userid=32642
View this thread: www.excelforum.com/showthread...hreadid=524554
- Jun 22 Fri 2007 20:38
activate macro only in sheet2
close
全站熱搜
留言列表
發表留言