ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sorting a listbox (https://www.excelbanter.com/excel-programming/376803-sorting-listbox.html)

DN

Sorting a listbox
 
Hi,

I'm have a worksheet with lots of tabs in it. I'm using the code below to
populate a listbox with all the sheetnames, however I would like the results
sorted in alphabetal order. Any ideas would be much appreciated. Thanks!

Sub PopulateListbox()

ListBox1.Clear

For i = 1 To Sheets.Count

ListBox1.AddItem Sheets(i).Name

Next

End Sub


Norman Jones

Sorting a listbox
 
Hi D,

See Jojn Walkenbach at:

http://j-walk.com:80/ss/excel/tips/tip47.htm


---
Regards,
Norman



"DN" wrote in message
...
Hi,

I'm have a worksheet with lots of tabs in it. I'm using the code below to
populate a listbox with all the sheetnames, however I would like the
results
sorted in alphabetal order. Any ideas would be much appreciated. Thanks!

Sub PopulateListbox()

ListBox1.Clear

For i = 1 To Sheets.Count

ListBox1.AddItem Sheets(i).Name

Next

End Sub





All times are GMT +1. The time now is 10:26 AM.

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