ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Using a macro how do I group every sheet within a book? (https://www.excelbanter.com/excel-discussion-misc-queries/18081-using-macro-how-do-i-group-every-sheet-within-book.html)

Pank Mehta

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.

Bob Phillips

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.




Pank Mehta

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.





Dave Peterson

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