ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet Name question (https://www.excelbanter.com/excel-programming/324247-sheet-name-question.html)

S G Booth

Sheet Name question
 
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.



Tom Ogilvy

Sheet Name question
 
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.





Christmas May[_2_]

Sheet Name question
 
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.




VBA Dabbler[_2_]

Sheet Name question
 
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.




S G Booth

Sheet Name question
 
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.







Tom Ogilvy

Sheet Name question
 
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.









Fredrik Wahlgren

Sheet Name question
 

"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





All times are GMT +1. The time now is 09:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com