ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet relocation within workbook (https://www.excelbanter.com/excel-programming/343834-worksheet-relocation-within-workbook.html)

dcwhiz

Worksheet relocation within workbook
 
I want to move a worksheet called "Test" to the beginning of several
workbooks.

I found

ActiveSheet.Move _
After:=ActiveWorkbook.Sheets(ActiveWorkbook.Sheets .Count)

on Microsoft's site and tried to change it to say ... Move _ Befo...
but this didn't work.

I can't say something like Move _ Befo=Sheets("Sheet1"), because the
workbooks don't have the same worksheet names. I need to use some sort
of relative reference.

Does anyone have any suggestions as to how I can write a macro that
will consistently move a specific sheet to the beginning of a workbook?

Thanks.


Norman Jones

Worksheet relocation within workbook
 
Hi DC,

Instead of using the sheet's name, try using its index:

Befo=Sheets(1)

---
Regards,
Norman



"dcwhiz" wrote in message
ups.com...
I want to move a worksheet called "Test" to the beginning of several
workbooks.

I found

ActiveSheet.Move _
After:=ActiveWorkbook.Sheets(ActiveWorkbook.Sheets .Count)

on Microsoft's site and tried to change it to say ... Move _ Befo...
but this didn't work.

I can't say something like Move _ Befo=Sheets("Sheet1"), because the
workbooks don't have the same worksheet names. I need to use some sort
of relative reference.

Does anyone have any suggestions as to how I can write a macro that
will consistently move a specific sheet to the beginning of a workbook?

Thanks.




dcwhiz

Worksheet relocation within workbook
 
Easier done than said. So the index of sheets is just a simple
reference to the sheet order? It seems all too easy compared to what I
was trying to do. Thank you very much for your help Norman.



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

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