The collection of selected sheets:
ActiveWindow.SelectedSheets
The number of sheets:
n = ActiveWindow.SelectedSheets.Count
i-th sheet selected:
ActiveWindow.SelectedSheets.Item(i)
Excellent! Thanks. Is there no way to access this information using a workbook object? I want to make sure that the sheets selected in the activewindow actually belong to the workbook (WB) being processed in the macro. I suppose I could check to see if ActiveWindow.SelectedSheets(x).parent.name = WB.name and if not, it's a different book.
Do you know something I don't? (well, you probably do ). I thought you could only have one workbook in a window - you might have more than one window on a workbook but not the other way round.
My concern is that the sub could end up processing sheets in a different book altogether. I can check this as I mentioned in my last message, although I suppose ActiveWindow.parent.name = WB.name is better than what I wrote (that's what you were trying to tell me wasn't it? Sorry, I sort of tangented off here).
I guess I'm satisfied knowing I can at least 'check' to see if the sheets are in the proper workbook, but not 100% since I can't enforce it...
or wait...
after WorkbookA.Activate, ActiveWindow.SelectedSheets could only refer to WorkbookA ...
I do believe this solves my problem. Just needed to talk through it--thanks Tony, thanks Combo!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.