ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   worksheet? (https://www.excelbanter.com/excel-programming/408051-worksheet.html)

Looping through

worksheet?
 
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

reklamo

worksheet?
 
If ActiveSheet.Name = "Current Month" Then

regards
reklamo


"Looping through" wrote:

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


Tom Hutchins

worksheet?
 
Use the ActiveSheet object to refer to whatever sheet is active:

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

Hope this helps,

Hutch

"Looping through" wrote:

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


FSt1

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

regards
FSt1

"Looping through" wrote:

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


Chip Pearson

worksheet?
 
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)



"Looping through" wrote in
message ...
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




All times are GMT +1. The time now is 10:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com