View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
excelent excelent is offline
external usenet poster
 
Posts: 695
Default Extract part of a Worksheet name.

try
ElseIf Mid(ActiveSheet.Name, 1, 3) = "CWR" Then


"Casey" skrev:


Hi,
Im having problems extracting part of a worksheet name to compare to a
text string.
Im getting a 438 error Object doesnt support this property or method.
I have looked in help and the Mid function doesnt seem to be supported
in VBA, but Im at a loss for a substitute. I just need to check if the
first three letters of the worksheet name = CWR

Here is an excerpt of my code.

ElseIf ActiveSheet.Name = "CWR LOG" Then
ComboBoxTopics.ListIndex = 2
ElseIf Application.WorksheetFunction.Mid(ActiveSheet.Name , 1, 3) =
"CWR" Then 'This is where the error hits.
ComboBoxTopics.ListIndex = 10


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=562204