First, I wouldn't use the default codenames--Sheet1, Sheet2, ...
I'd rename the codenames to something significant and something consistent in
format.
If the sheets represented customers, I'd use their ID and maybe some counter.
Then I could check the first xx characters (or last yy characters) to decide
what to do.
Catego001, Catego002, ...
Prices001, Prices002, ...
Custom001, Custom002, ...
select case left(lcase(ws.codename),6)
case is = "catego"
....
I think it would make it easier than trying to remember how the sheets are
divided.
You can show the properties of the worksheet (in the VBE) and change the (name)
property to what you want.
=========
But (I wouldn't use this), you could still strip out the digits from all the
codenames with something like:
Option Explicit
Sub testme()
Dim ws As Worksheet
Dim pWs As Worksheet
Dim LastNumber As Long
Set ws = ActiveSheet
LastNumber = -99
On Error Resume Next
LastNumber = CLng(Replace(expression:=ws.CodeName, _
Find:="sheet", Replace:="", _
compare:=vbTextCompare))
On Error GoTo 0
Set pWs = Nothing
If LastNumber = -99 Then
'ignore it
Else
Select Case LastNumber
Case 1 To 25
Set pWs = Sheet51
Case 26 To 50
Set pWs = Sheet52
End Select
End If
If pWs Is Nothing Then
MsgBox "nothing!"
Else
MsgBox pWs.Name
End If
End Sub