list sorted by ws.codename but shows ws.name in list

KDS14589

Board Regular
Joined
Jan 10, 2019
Messages
202
Office Version
  1. 2016
Platform
  1. Windows
I would list ALL MY CODE ATTEMPTS but not enough space.

I’m trying to get a list of all worksheets in a workbook, but it would be in ascending order by worksheet.codename but only show a list of the worksheet.name in worksheet GE03.RANGE(“AH5:AH” & LDR_EH)
The examples I've seen actually alphabetically rearrange the worksheets, but I just want a list in GE03.RANGE(“AH5:AH” & LDR_EH).

worksheet.codename’s are 4 charters; two letters followed by two numbers ie GE03

The code I’m using for just a random list is…..
VBA Code:
Dim Ws As Worksheet

Dim x As Integer

Dim wbk As Workbook

Dim wbkName As String



x = 5

wbkName = ThisWorkbook.Name

Set wbk = Application.Workbooks(wbkName)

For Each Ws In wbk.Worksheets

GE03.Cells(x, 34) = Ws.Name

Next Ws
 
Make this small change
Rich (BB code):
GE03.Range("AH5").Resize(UBound(Ary) + 1).Value = Application.Transpose(Ary)
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Add the +1 as below
Code:
Sheet4.Range("AH5").Resize(UBound(Ary) + 1).Value = Application.Transpose(Ary)

I did not think I needed to use the F5 but I was wrong.
 
Upvote 0

Forum statistics

Threads
1,222,902
Messages
6,168,938
Members
452,227
Latest member
sam1121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top