ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet number (https://www.excelbanter.com/excel-programming/304930-sheet-number.html)

Glen[_4_]

Sheet number
 
I can capture the sheet name with "ActiveSheet.Name"
How do I capture the active sheet number?

Thanks
Glen

Norman Jones

Sheet number
 
Hi Glen,

Try:

Activesheet.Index

---
Regards,
Norman



"Glen" wrote in message
...
I can capture the sheet name with "ActiveSheet.Name"
How do I capture the active sheet number?

Thanks
Glen




No Name

Sheet number
 
Norman,
Thanks - this worked great!
Now I need to count the number of sheets selected.
If I use sheets.count I get all sheets.
I only want to count the number selected
Say I have 10 sheets and I only select 3, what would my
command line look like?

MySelectedSheets = ??


Glen

-----Original Message-----
Hi Glen,

Try:

Activesheet.Index

---
Regards,
Norman



"Glen" wrote in

message
...
I can capture the sheet name with "ActiveSheet.Name"
How do I capture the active sheet number?

Thanks
Glen



.


Frank Kabel

Sheet number
 
Hi
try
msgbox activeworkbook.Windows(1).SelectedSheets.count

--
Regards
Frank Kabel
Frankfurt, Germany


wrote:
Norman,
Thanks - this worked great!
Now I need to count the number of sheets selected.
If I use sheets.count I get all sheets.
I only want to count the number selected
Say I have 10 sheets and I only select 3, what would my
command line look like?

MySelectedSheets = ??


Glen

-----Original Message-----
Hi Glen,

Try:

Activesheet.Index

---
Regards,
Norman



"Glen" wrote in message
...
I can capture the sheet name with "ActiveSheet.Name"
How do I capture the active sheet number?

Thanks
Glen



.


Ron de Bruin

Sheet number
 
MsgBox ActiveWindow.SelectedSheets.Count

If you want to do something on each sheet is easier to loop like this

Sub test()
Dim sh As Worksheet
For Each sh In ActiveWindow.SelectedSheets
MsgBox sh.Name
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


wrote in message ...
Norman,
Thanks - this worked great!
Now I need to count the number of sheets selected.
If I use sheets.count I get all sheets.
I only want to count the number selected
Say I have 10 sheets and I only select 3, what would my
command line look like?

MySelectedSheets = ??


Glen

-----Original Message-----
Hi Glen,

Try:

Activesheet.Index

---
Regards,
Norman



"Glen" wrote in

message
...
I can capture the sheet name with "ActiveSheet.Name"
How do I capture the active sheet number?

Thanks
Glen



.




Norman Jones

Sheet number
 
Hi Glen'

Try:

ActiveWindow.SelectedSheets.Count

---
Regards,
Norman


wrote in message
...
Norman,
Thanks - this worked great!
Now I need to count the number of sheets selected.
If I use sheets.count I get all sheets.
I only want to count the number selected
Say I have 10 sheets and I only select 3, what would my
command line look like?

MySelectedSheets = ??


Glen

-----Original Message-----
Hi Glen,

Try:

Activesheet.Index

---
Regards,
Norman



"Glen" wrote in

message
...
I can capture the sheet name with "ActiveSheet.Name"
How do I capture the active sheet number?

Thanks
Glen



.




No Name

Sheet number
 
Just what I needed! Thanks guys. I am rather new at
this.

Glen

-----Original Message-----
MsgBox ActiveWindow.SelectedSheets.Count

If you want to do something on each sheet is easier to

loop like this

Sub test()
Dim sh As Worksheet
For Each sh In ActiveWindow.SelectedSheets
MsgBox sh.Name
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


wrote in message

...
Norman,
Thanks - this worked great!
Now I need to count the number of sheets selected.
If I use sheets.count I get all sheets.
I only want to count the number selected
Say I have 10 sheets and I only select 3, what would my
command line look like?

MySelectedSheets = ??


Glen

-----Original Message-----
Hi Glen,

Try:

Activesheet.Index

---
Regards,
Norman



"Glen" wrote in

message
...
I can capture the sheet name with "ActiveSheet.Name"
How do I capture the active sheet number?

Thanks
Glen


.



.



All times are GMT +1. The time now is 03:16 PM.

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