VBA - identifying which worksheet is active

G

Guest

Must be the weather or something but ...
I am having problems working out how to retrieve the sequential number of an
active worksheet (Activeworksheet does not supptort the various properties I
have tried...). Yeah, I know, should be trivial but I am obviosuly not
thinking of the right key words to find any help either. Suggestions much
appreciated. All I want to do really is count how many more worksheets IO
have after the active one.
Many thanks and best wishes.
 
G

Guest

Sub which()
Dim n As String
n = ActiveSheet.Name
i = 1
For Each w In Worksheets
If w.Name = n Then
MsgBox (i)
End If
i = i + 1
Next
End Sub
 
G

Guest

Many thanks for the suggestion. This would definately work but is more
complicated than I had hoped for. I was hoping Index would work but I get an
error message when I try that - might of course be my typing.
Anyway, thanks for the suggestion.
Best wishes, Boris.
 

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

Top