Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default 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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sheet protection question [email protected] Excel Discussion (Misc queries) 3 December 29th 07 12:02 AM
Sheet name question Adam Kroger Excel Discussion (Misc queries) 4 December 15th 05 02:34 AM
Sorting sheet question browie Excel Discussion (Misc queries) 1 August 19th 05 04:56 PM
VBA Question: going through rows in a sheet via vba Mariam[_3_] Excel Programming 1 June 24th 04 11:15 PM
Another loop & sheet question steve Excel Programming 4 November 25th 03 02:12 PM


All times are GMT +1. The time now is 07:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"