Reputation: 59
This seems like a basic question but have been unable to troubleshoot or find anything online. I have a macro that creates sheets based on a customer number. The sheets I need to manipulate are customer number sheets, the remaining sheets have text names. Is it possible to identify the sheet names that are numeric in nature? The customer names are all 6 digits but other than that can be any combination of numbers.
I have looked online and all I can find are loops using some type of constant name or number to select the given sheet.
Example sheet names:
606278 705213 134875 MainInformation
Is there anyway to select these sheets given there is no numbering convention, only that they are always 6 digits?
Upvotes: 0
Views: 1363
Reputation: 11188
How about this as an example:
Public Sub DoWorkbooks()
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
If Len(wks.Name) = 6 And IsNumeric(wks.Name) Then
Debug.Print wks.Name
End If
Next
End Sub
Upvotes: 1