View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
IT_roofer IT_roofer is offline
external usenet poster
 
Posts: 45
Default If Worksheet is active then...

I would probably do something like this:

sub run_or_not()
if ActiveSheet.Name = "Sheet1" then
'your code here
else
'your alternate code here
end if
end sub

HTH - IT_Roofer

"Darin Kramer" wrote:


HI there,

When a user runs a macro I need the macro to check which sheet he is
running it from, if it is the specified sheet then the macro should run,
if not it shouldent.

Whats wrong with my VB below...??

Thanks

D

Sub Run_or_not

Dim ws As Worksheet

With ActiveSheet
If ws.Name = "APP_D" Then
Call fix

ElseIf ws.Name = "x" Then


End If
End With


*** Sent via Developersdex http://www.developersdex.com ***