ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   identify active sheet (https://www.excelbanter.com/excel-programming/329941-identify-active-sheet.html)

mike allen[_2_]

identify active sheet
 
I am trying to identify my currently active sheet name.

If sheets(ActiveSheet) = sheets("first sheet") Then
a=1
ElseIf sheets(ActiveSheet) = sheets("second sheet") Then
a=2
End If

this does not work. I have tried many variations of the first line, but no
luck. any ideas? thx



Steve R[_3_]

identify active sheet
 
This should help:

sub Check()
MsgBox ActiveSheet.Name
MsgBox Sheets(1).Name
end sub


"mike allen" wrote in message
...
I am trying to identify my currently active sheet name.

If sheets(ActiveSheet) = sheets("first sheet") Then
a=1
ElseIf sheets(ActiveSheet) = sheets("second sheet") Then
a=2
End If

this does not work. I have tried many variations of the first line, but
no luck. any ideas? thx





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

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