ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   identify selected worksheets (https://www.excelbanter.com/excel-programming/412982-identify-selected-worksheets.html)

brzak

identify selected worksheets
 
probably very simple, but I can't quite work it out.

If more than one worksheet is selected, the code for whis action would
be:

Sheets(Array("Sheet1", "Sheet2")).Select

how do i access this information. (I would like to apply changes to
Sheet1 and Sheet2, and not to Sheet3)

thanks

Jim Thomlinson

identify selected worksheets
 
Code acts on only one sheet at a time. If you want to update multiple sheets
you need to write code traverse through those sheets individually.
--
HTH...

Jim Thomlinson


"brzak" wrote:

probably very simple, but I can't quite work it out.

If more than one worksheet is selected, the code for whis action would
be:

Sheets(Array("Sheet1", "Sheet2")).Select

how do i access this information. (I would like to apply changes to
Sheet1 and Sheet2, and not to Sheet3)

thanks


brzak

identify selected worksheets
 
Thanks, though my question was how to work out which sheets are
selected. i.e. how do I work out which sheets to traverse?

I can't do this for example:

Dim A as Worksheet

For Each A in Selection
'Actions
Next A

Cheers


On Jun 23, 4:31*pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
Code acts on only one sheet at a time. If you want to update multiple sheets
you need to write code traverse through those sheets individually.
--
HTH...

Jim Thomlinson

"brzak" wrote:
probably very simple, but I can't quite work it out.


If more than one worksheet is selected, the code for whis action would
be:


* * * Sheets(Array("Sheet1", "Sheet2")).Select


how do i access this information. (I would like to apply changes to
Sheet1 and Sheet2, and not to Sheet3)


thanks



Bob Phillips

identify selected worksheets
 
Dim sh As Object

For Each sh In ActiveWindow.SelectedSheets

MsgBox sh.Name
Next sh


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"brzak" wrote in message
...
Thanks, though my question was how to work out which sheets are
selected. i.e. how do I work out which sheets to traverse?

I can't do this for example:

Dim A as Worksheet

For Each A in Selection
'Actions
Next A

Cheers


On Jun 23, 4:31 pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
Code acts on only one sheet at a time. If you want to update multiple
sheets
you need to write code traverse through those sheets individually.
--
HTH...

Jim Thomlinson

"brzak" wrote:
probably very simple, but I can't quite work it out.


If more than one worksheet is selected, the code for whis action would
be:


Sheets(Array("Sheet1", "Sheet2")).Select


how do i access this information. (I would like to apply changes to
Sheet1 and Sheet2, and not to Sheet3)


thanks




Gary''s Student

identify selected worksheets
 
Sub which_ones()
For i = 1 To ActiveWindow.SelectedSheets.Count
MsgBox (ActiveWindow.SelectedSheets(i).Name)
Next
End Sub

--
Gary''s Student - gsnu200793

Cako

identify selected worksheets
 
Ah great, I didn't think to use ActiveWindow, I looked down the full
list of Worksheet/Sheet object members (at least three times) but
found nothing.

I'll have to keep ActiveWindow in mind for the future - seems to have
a lot of useful properties.

Thanks guys!

On Jun 23, 5:14*pm, Gary''s Student
wrote:
Sub which_ones()
For i = 1 To ActiveWindow.SelectedSheets.Count
* * MsgBox (ActiveWindow.SelectedSheets(i).Name)
Next
End Sub

--
Gary''s Student - gsnu200793




All times are GMT +1. The time now is 05:04 PM.

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