View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default When Sheet Is Active, Run Macro, Otherwise Dont

Sub MyMacro()
if Activesheet.Name < "Sheet2" then exit sub

' current code

end Sub

--
Regards,
Tom Ogilvy


"JB2010" wrote:

Hi


Ive been trawling through previous postings to try & find an answer to this
as it must be so simple, but to no avail.


All i need is the code that tells VBA "When 'Sheet 2' is active
(i.e.visable), run the macro, otherwise dont".

Sorry that this is so lame! Please let me know if you need anymore info


cheers


jb