worksheet?

  • Thread starter Thread starter Looping through
  • Start date Start date
L

Looping through

Is there a way to see if a certain worksheet is active in a workbook?

If it is active continue with code. If it is not active end.

this is what I got but it allows the code to keep going without the "Current
Month" worksheet being active.

If Worksheets("Current Month").Visible = False Then
End
Else

TIA
Peter
 
Use the ActiveSheet object to refer to whatever sheet is active:

If ActiveSheet.Name = "Current Month" Then
'do something

Hope this helps,

Hutch
 
hi
probably more than one way to do this but...
If ActiveSheet.Name <> "CurrentMonth" Then
exit sub
Else
runmorecode
End If

regards
FSt1
 
Try something like

If ActiveSheet.Name = "Current Month" Then
' Current Month is active
Else
' Current Month is not active
End If


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top