ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sorting and deleting sheets (https://www.excelbanter.com/excel-programming/356196-sorting-deleting-sheets.html)

Spike

sorting and deleting sheets
 
i will be grateful for a piece of code to sort all the sheets in a workbook,
say to the left of a certain sheet, and also a piece of code to delete all
the worksheets say to the right of a certain sheet.

I am sure this must have been asked before but i cannot find it in the forum
--
with kind regards

Spike

Tom Ogilvy

sorting and deleting sheets
 
You probably should delete the sheets first, then sort the rest - or vice
versa - depending on the functionality you want. To delete sheets from the
right side of the tab order:

for i = worksheets.count to 5 step -1
Application.displayAlerts = False
Worksheets(i).Delete
Application.DisplayAlerts = True
Next

to sort sheets in the tab order you can use code like this at Chip Pearson's
site:
http://www.cpearson.com/excel/sortws.htm

--
Regards,
Tom Ogilvy


"Spike" wrote:

i will be grateful for a piece of code to sort all the sheets in a workbook,
say to the left of a certain sheet, and also a piece of code to delete all
the worksheets say to the right of a certain sheet.

I am sure this must have been asked before but i cannot find it in the forum
--
with kind regards

Spike


Spike

sorting and deleting sheets
 
excellent many thanks
--
with kind regards

Spike


"Tom Ogilvy" wrote:

You probably should delete the sheets first, then sort the rest - or vice
versa - depending on the functionality you want. To delete sheets from the
right side of the tab order:

for i = worksheets.count to 5 step -1
Application.displayAlerts = False
Worksheets(i).Delete
Application.DisplayAlerts = True
Next

to sort sheets in the tab order you can use code like this at Chip Pearson's
site:
http://www.cpearson.com/excel/sortws.htm

--
Regards,
Tom Ogilvy


"Spike" wrote:

i will be grateful for a piece of code to sort all the sheets in a workbook,
say to the left of a certain sheet, and also a piece of code to delete all
the worksheets say to the right of a certain sheet.

I am sure this must have been asked before but i cannot find it in the forum
--
with kind regards

Spike



All times are GMT +1. The time now is 12:33 AM.

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