![]() |
Retrieve Index of Activeworkbook?
This seems easy, but I'm not seeing it.
How do you retrieve the index of the workbooks collection which applies the activeworkbook? I guess one way would be to run through the Workbooks collection looking to see if workbooks(i).name = activeworkbook.name Is there a better way? Thanks. |
Retrieve Index of Activeworkbook?
Don't know is this is what you want, but try it...
Dim x As Long, wbn As String, wb As Workbook For Each wb In Application.Workbooks x = Application.Windows(wb.Name).Index wbn = wb.Name Next you could change wb.Name to Activeworkbook.Name -- steveB Remove "AYN" from email to respond "mark" wrote in message ... This seems easy, but I'm not seeing it. How do you retrieve the index of the workbooks collection which applies the activeworkbook? I guess one way would be to run through the Workbooks collection looking to see if workbooks(i).name = activeworkbook.name Is there a better way? Thanks. |
Retrieve Index of Activeworkbook?
Hello Mark, A Collection Object has both an Index and a Key Value associated with a stored value. Unfortunataley, the object class doesn't support returning the index by using the key value or vice versa. The only option you have is to use a loop to go through the index numbers and compare the name property to the ActiveWorkbook Name. Sincerly, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=378245 |
Retrieve Index of Activeworkbook?
The only option you have is to use a loop to go through the index numbers
and compare the name property to the ActiveWorkbook Name. Okay, thanks, Leith. As you saw, that was the option that I thought of as I was posting the question... guess that's the answer. Rahmat ('thank you', in Kyrgyz). |
All times are GMT +1. The time now is 08:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com