Thread: active sheet
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default active sheet

Sub macro1A()
If ActiveSheet.Type = xlWorksheet Then
MsgBox "It's a worksheet"
UserForm1.Show
ActiveSheet.Unprotect
Else
MsgBox "It's not a worksheet"
End If
End Sub


--
HTH,
Bernie
MS Excel MVP


"enyaw" wrote in message
...
I have a custom toolbar and on that toolbar I have a button that runs a
macro. I have the macro running on the activesheet so it runs on whatever
sheet is open at the time. The problem is that I have a chart sheet. I want
to be able to stop the macro running if the chart sheet is the active sheet.
Can anyone help?

This is my code so far:

Sub macro1()
ActiveSheet.Select
UserForm1.Show
ActiveSheet.Unprotect
End Sub