Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to check for a worksheet's name, and need to be sure that all the
following example names will be valid: SHEET ....... Sheet......... or sheet guess that's a load of "sheet"! Can I do this reliably with UCase, or ? If (UCase(.Name) = Regards. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if strcomp(sh.name,"sheet",vbTextCompare) = 0 then
or if lcase(sh.name) = "sheet" then or if ucase(sh.name) = "SHEET" then -- Regards, Tom Ogilvy "S G Booth" wrote in message ... I need to check for a worksheet's name, and need to be sure that all the following example names will be valid: SHEET ....... Sheet......... or sheet guess that's a load of "sheet"! Can I do this reliably with UCase, or ? If (UCase(.Name) = Regards. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many thanks to you all.
It seems I must test for each of the 3 possibilities. However, I thought I had read somewhere that UCase could be used with a mixture of upper and lower case characters. Regards and thanks. "Tom Ogilvy" wrote in message ... if strcomp(sh.name,"sheet",vbTextCompare) = 0 then or if lcase(sh.name) = "sheet" then or if ucase(sh.name) = "SHEET" then -- Regards, Tom Ogilvy "S G Booth" wrote in message ... I need to check for a worksheet's name, and need to be sure that all the following example names will be valid: SHEET ....... Sheet......... or sheet guess that's a load of "sheet"! Can I do this reliably with UCase, or ? If (UCase(.Name) = Regards. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you didn't understand. You can use anyone of the the three tests I provided
the OR was not code, but prose. All three methods, as presented, are case insensitive. -- Regards, Tom Ogilvy "S G Booth" wrote in message ... Many thanks to you all. It seems I must test for each of the 3 possibilities. However, I thought I had read somewhere that UCase could be used with a mixture of upper and lower case characters. Regards and thanks. "Tom Ogilvy" wrote in message ... if strcomp(sh.name,"sheet",vbTextCompare) = 0 then or if lcase(sh.name) = "sheet" then or if ucase(sh.name) = "SHEET" then -- Regards, Tom Ogilvy "S G Booth" wrote in message ... I need to check for a worksheet's name, and need to be sure that all the following example names will be valid: SHEET ....... Sheet......... or sheet guess that's a load of "sheet"! Can I do this reliably with UCase, or ? If (UCase(.Name) = Regards. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You should be able to accomplish this with the "Ucase" command.
if ucase(Activesheet.name)="SHEET" THEN msgbox ("matches") "S G Booth" wrote: I need to check for a worksheet's name, and need to be sure that all the following example names will be valid: SHEET ....... Sheet......... or sheet guess that's a load of "sheet"! Can I do this reliably with UCase, or ? If (UCase(.Name) = Regards. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Since the application doesn't allow for the same sheet name, regardless of
the character case, using UCase() would work well. You might want to use UCase() on both sides of a comparison, e.g., UCase(Sheets(i).Name) = UCase(MySheetVariableName) Good luck, VBA Dabbler "S G Booth" wrote: I need to check for a worksheet's name, and need to be sure that all the following example names will be valid: SHEET ....... Sheet......... or sheet guess that's a load of "sheet"! Can I do this reliably with UCase, or ? If (UCase(.Name) = Regards. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "S G Booth" wrote in message ... I need to check for a worksheet's name, and need to be sure that all the following example names will be valid: SHEET ....... Sheet......... or sheet guess that's a load of "sheet"! Can I do this reliably with UCase, or ? If (UCase(.Name) = Regards. Valid? What name would make a sheet's name invalid??? / Fredrik |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sheet protection question | Excel Discussion (Misc queries) | |||
Sheet name question | Excel Discussion (Misc queries) | |||
Sorting sheet question | Excel Discussion (Misc queries) | |||
VBA Question: going through rows in a sheet via vba | Excel Programming | |||
Another loop & sheet question | Excel Programming |