Using a macro how do I group every sheet within a book?
Using a macro how do I group every sheet within a book?
I have created a macro, but find that the names of the sheets will differ every time and hence I need a mechanism that will automatically select all of them to allow me to undertake editing within them all at the same time. |
Dim arySheets
Dim sh Dim i As Long ReDim arySheets(ActiveWorkbook.Worksheets.Count - 1) For Each sh In ActiveWorkbook.Worksheets arySheets(i) = sh.Name i = i + 1 Next sh Sheets(arySheets).Select -- HTH RP (remove nothere from the email address if mailing direct) "Pank Mehta" wrote in message ... Using a macro how do I group every sheet within a book? I have created a macro, but find that the names of the sheets will differ every time and hence I need a mechanism that will automatically select all of them to allow me to undertake editing within them all at the same time. |
Bob,
Many thanks "Bob Phillips" wrote: Dim arySheets Dim sh Dim i As Long ReDim arySheets(ActiveWorkbook.Worksheets.Count - 1) For Each sh In ActiveWorkbook.Worksheets arySheets(i) = sh.Name i = i + 1 Next sh Sheets(arySheets).Select -- HTH RP (remove nothere from the email address if mailing direct) "Pank Mehta" wrote in message ... Using a macro how do I group every sheet within a book? I have created a macro, but find that the names of the sheets will differ every time and hence I need a mechanism that will automatically select all of them to allow me to undertake editing within them all at the same time. |
Another way:
Sheets.Select or worksheets.select (if you want to avoid selecting non-worksheets (like Chart sheets).) Pank Mehta wrote: Using a macro how do I group every sheet within a book? I have created a macro, but find that the names of the sheets will differ every time and hence I need a mechanism that will automatically select all of them to allow me to undertake editing within them all at the same time. -- Dave Peterson |
All times are GMT +1. The time now is 05:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com