ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA - identifying which worksheet is active (https://www.excelbanter.com/excel-programming/400573-vba-identifying-worksheet-active.html)

Boris

VBA - identifying which worksheet is active
 
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 I have
after the active one.
Many thanks and best wishes.

Rick Rothstein \(MVP - VB\)

VBA - identifying which worksheet is active
 
The property you are looking for is Index...

NumberOfSheetsRemaining = Worksheets.Count - ActiveSheet.Index

Rick


"Boris" wrote in message
...
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 I
have
after the active one.
Many thanks and best wishes.



Boris

VBA - identifying which worksheet is active
 
Thanks Rick, very good of you to reply. I had thought of "index" but, when I
tried it in my immediate window, I got a VB error message to say that the
property was not suppoted... Must have mistyped something!
Many thanks again, Boris.

"Rick Rothstein (MVP - VB)" wrote:

The property you are looking for is Index...

NumberOfSheetsRemaining = Worksheets.Count - ActiveSheet.Index

Rick


"Boris" wrote in message
...
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 I
have
after the active one.
Many thanks and best wishes.





All times are GMT +1. The time now is 02:54 AM.

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