ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving selected sheets (https://www.excelbanter.com/excel-programming/277766-moving-selected-sheets.html)

Primoz Bradac

Moving selected sheets
 
I want to create a macro which would move a set of selected sheets from
one book to another.

I know how to select the sheets and move them e.g.:

Sheets(Array("List5", "List3")).Select
Sheets("List3").Activate
Sheets(Array("Sheet5", "Sheet3")).Move Befo=Workbooks
("Book3").Sheets(3)

But what if the sheets are already selected before starting the macro.
So I don't need the "Select" method and instead of Sheets(Array
("Sheet5"...).Move I'd need something like Sheets(<selected
sheets).Move

TIA,
Primoz

Bernie Deitrick[_2_]

Moving selected sheets
 
Primoz,

Use

ActiveWindow.SelectedSheets.Move ......

HTH,
Bernie
Excel MVP


"Primoz Bradac" wrote in message om...
I want to create a macro which would move a set of selected sheets from
one book to another.

I know how to select the sheets and move them e.g.:

Sheets(Array("List5", "List3")).Select
Sheets("List3").Activate
Sheets(Array("Sheet5", "Sheet3")).Move Befo=Workbooks
("Book3").Sheets(3)

But what if the sheets are already selected before starting the macro.
So I don't need the "Select" method and instead of Sheets(Array
("Sheet5"...).Move I'd need something like Sheets(<selected
sheets).Move

TIA,
Primoz




Primoz Bradac

Moving selected sheets
 
Thanks a lot Bernie, it works fine.

Primoz

In article ,
says...
Primoz,

Use

ActiveWindow.SelectedSheets.Move ......

HTH,
Bernie
Excel MVP


"Primoz Bradac" wrote in message news:MPG.



All times are GMT +1. The time now is 02:30 AM.

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