View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Wild Bill[_2_] Wild Bill[_2_] is offline
external usenet poster
 
Posts: 90
Default Upper/Lower case problem

Your understanding (and code) appears to be correct. No offense, but
based on my own embarrassing experiences, perhaps your eyes are playing
a trick on you - maybe with spaces vs. underscores or such.

To slay this beast it won't hurt (during development) to add this just
before your Match:
debug.print "<" & activesheet.name & "" ' use some unique delimiter

This kind of thing may be useful on something down the road anyway; from
time to time it shows me I need to trim something.

On Wed, 20 Aug 2003 11:37:28 +0100, "Scott" wrote:

Hi,

I'm having a little problem with this code and I haven't a clue what the
problem is.
This code checks to see if the active sheet is listed in the array, if it is
then it exits the sub.

My problem is that this works fine in a new workbook, even if the case is
different. But the workbook in which I try to run this code works fine if
the case is the same, but if the case is different the sheet is not found
and the massage "Sheet Not Found" is displayed. I don't think there's
anything special about this workbook, so this is really confusing me.

Has anyone got any ideas to what the problem is?

res = Application.Match(ActiveSheet.Name, Array("sheet1", "sheet2",
"sheet3"), 0)
If Not IsError(res) Then
Msgbox "Sheet Found"
Exit Sub

End If

Msgbox "Sheet Not Found"