Jmoz092
Board Regular
- Joined
- Sep 8, 2017
- Messages
- 184
- Office Version
- 365
- 2011
- Platform
- Windows
- MacOS
After searching for examples, I found a code that I'm trying to manipulate to fit my needs here: example
I'm trying to make a list (as column headers) of all the worksheets in a summary workbook for all of the worksheets that have a MM-DD-YY format.
I can get the code to work, and list the names of all the worksheets, but I can't make it not display the data and reference sheets contained in the workbook.
this works, but lists the data sheets in the header row also:
This one does not work, as I try to sort out the non MM-DD-YY worksheets:
What mistakes am I making the 2nd code, and how can I correct them?
I'm trying to make a list (as column headers) of all the worksheets in a summary workbook for all of the worksheets that have a MM-DD-YY format.
I can get the code to work, and list the names of all the worksheets, but I can't make it not display the data and reference sheets contained in the workbook.
this works, but lists the data sheets in the header row also:
Code:
Sub SheetNamesAsColumns()
Dim ws As Worksheet
Dim x As Integer
x = 1
For Each ws In Worksheets
Sheets("Index").Cells(1, x) = ws.Name
x = x + 1
Next ws
End Sub
This one does not work, as I try to sort out the non MM-DD-YY worksheets:
Code:
Sub SheetNamesAsColumns()
Dim ws As Worksheet
Dim x As Integer
x = 1
For Each ws In Worksheets
If ws.Name Like "**-**-**" Then
Sheets("Index").Cells(1, x) = ws.Name
x = x + 1
Next ws
End If
End Sub
What mistakes am I making the 2nd code, and how can I correct them?
Last edited: