Issue :
How can I test a sheet / tab whether it belongs to the selected / grouped sheets or not ?
This is my first post here but I have used info posted on this forum before.
So big thank you to all the community.
I admit I have not spent much time trying to find a solution to my problem.
I hope someone may have an "instant" answer at hand.
I want to perform certain action on each of the sheets that are currently grouped within a workbook.
These can be selected more or less randomly so do not assume any logic in terms of selection. There might be all of the sheets, there might be just one ...
I need VBA to cycle through all selected tabs "doing something".
It might be beneficial if the selected sheets remain selected after the process finishes but :
- it is not essential, only beneficial
- the "process" may actually deselect individual sheets or ungroup them altogether
I thought that in first step I may need to create an array of "markers" for all the sheets within a workbook to store info about which sheets are grouped / selected and which are not.
Then I can cycle through all the sheets and perform the "processing" on those that are marked as grouped.
The end action could be to recreate the group if the process ungroups the sheets but, as i wrote, this is a "nice-to-have" requirement.
I think I have come across an Excel "object" that represents grouped sheets but I do not want to cycle through its members in case the "processing" may ungroup the sheets.
I thought it would be prudent to store info about which sheets are groupped and which are not upfront before any "processing" commences.
Then I could use this info for "conditional" processing ... if grouped to do it ... if not grouped do not do it ...
How can I test a sheet / tab whether it belongs to the selected / grouped sheets or not ?
Activesheet seems to point to a single sheets that, presumably, is "on top of the stack" and actually displayed on screen (???).
What is the sheet property I should test ?
There is an action .Select but I have not come across a property .Selected or .Grouped ... I think.
Regards
How can I test a sheet / tab whether it belongs to the selected / grouped sheets or not ?
This is my first post here but I have used info posted on this forum before.
So big thank you to all the community.
I admit I have not spent much time trying to find a solution to my problem.
I hope someone may have an "instant" answer at hand.
I want to perform certain action on each of the sheets that are currently grouped within a workbook.
These can be selected more or less randomly so do not assume any logic in terms of selection. There might be all of the sheets, there might be just one ...
I need VBA to cycle through all selected tabs "doing something".
It might be beneficial if the selected sheets remain selected after the process finishes but :
- it is not essential, only beneficial
- the "process" may actually deselect individual sheets or ungroup them altogether
I thought that in first step I may need to create an array of "markers" for all the sheets within a workbook to store info about which sheets are grouped / selected and which are not.
Then I can cycle through all the sheets and perform the "processing" on those that are marked as grouped.
The end action could be to recreate the group if the process ungroups the sheets but, as i wrote, this is a "nice-to-have" requirement.
I think I have come across an Excel "object" that represents grouped sheets but I do not want to cycle through its members in case the "processing" may ungroup the sheets.
I thought it would be prudent to store info about which sheets are groupped and which are not upfront before any "processing" commences.
Then I could use this info for "conditional" processing ... if grouped to do it ... if not grouped do not do it ...
How can I test a sheet / tab whether it belongs to the selected / grouped sheets or not ?
Activesheet seems to point to a single sheets that, presumably, is "on top of the stack" and actually displayed on screen (???).
What is the sheet property I should test ?
There is an action .Select but I have not come across a property .Selected or .Grouped ... I think.
Regards
Last edited: