ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I move a sheet to the end of the workbook in VB? (https://www.excelbanter.com/excel-programming/349649-how-can-i-move-sheet-end-workbook-vbulletin.html)

Jon Davie

How can I move a sheet to the end of the workbook in VB?
 
I know how to move the sheets around:

Sheets("1996").Select
Sheets("1996").Move After:=Sheets(2)

But how can I move the sheet to the end of the book if the number of sheets
in the book changes often?

Chip Pearson

How can I move a sheet to the end of the workbook in VB?
 
Jon,

Try the following:

With ThisWorkbook.Worksheets
.Item("1996").Move after:=.Item(.Count)
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Jon Davie" <Jon wrote in
message
...
I know how to move the sheets around:

Sheets("1996").Select
Sheets("1996").Move After:=Sheets(2)

But how can I move the sheet to the end of the book if the
number of sheets
in the book changes often?





All times are GMT +1. The time now is 04:00 AM.

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