View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Fastest way to select a sheet codename

Hi again Robert,

Answering your last post you could do it using the following method.

Select Case Val(Mid(ws.CodeName, 6))
Case 1 To 25
Set pWS = Sheet51
Case 26 To 50
Set pWS = Sheet52
End Select


--
Regards,

OssieMac


"Robert Crandal" wrote:

Sure, I'll try to elaborate on my "Do stuff" code.

Basically, if the "ws.CodeName" is between Sheet1 and Sheet25,
then the "Do stuff" is as follows:

Set pWS = Sheet51

Then, if "ws.CodeName" is between Sheet26 and Sheet50, then
the "Do stuff" is:

Set pWS = Sheet52

It would be nice if I could use the "Select Case" statement as
follows (but I don't think it will work):

Select Case ws.CodeName

Case "Sheet1" to "Sheet25":

Set pWS = Sheet51

Case "Sheet26" to "Sheet50":

Set pWS = Sheet52

End Select