ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   case (https://www.excelbanter.com/excel-programming/354094-case.html)

phil

case
 
is it possible to check the case of a letter. All the functions i found in
help seem to be able to convert text to a particular case but not check the
case

Jim Thomlinson[_5_]

case
 
dim myString as string

myString = "a"
if ucase(mySting) = mystring then
msgbox "UpperCase"
else
msgbox "LowerCase"
endif
--
HTH...

Jim Thomlinson


"phil" wrote:

is it possible to check the case of a letter. All the functions i found in
help seem to be able to convert text to a particular case but not check the
case


Dave Peterson

case
 
You can use =exact()

=exact(a1,upper(a1))

maybe????



phil wrote:

is it possible to check the case of a letter. All the functions i found in
help seem to be able to convert text to a particular case but not check the
case


--

Dave Peterson

Dave Peterson

case
 
And VBA also has a StrComp function.

You could use that to test for exact matches, too.

phil wrote:

is it possible to check the case of a letter. All the functions i found in
help seem to be able to convert text to a particular case but not check the
case


--

Dave Peterson

Gary Keramidas

case
 
here's a less elegant way than the others, but just as an example


Sub test()
Debug.Print Asc(Range("A1").Value)
If Asc(Range("A1").Value) <= 90 And Asc(Range("A1").Value) = 65 Then
Range("B1").Value = "UPPER CASE"
End If
If Asc(Range("A1").Value) = 97 And Asc(Range("A1").Value) <= 122 Then
Range("B1").Value = "lower case"
End If
End Sub

--


Gary


"phil" wrote in message
...
is it possible to check the case of a letter. All the functions i found in
help seem to be able to convert text to a particular case but not check the
case




Desert Piranha[_53_]

case
 

phil Wrote:
is it possible to check the case of a letter. All the functions i found
in
help seem to be able to convert text to a particular case but not check
the
case

Hi Phil,
To add to the other info here;

If data to be checked is in A6

'=IF(EXACT(A6,UPPER(A6)),"Upper Case",IF(EXACT(A6,LOWER(A6)),"Lower
Case","Upper and Lower Case"))


--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=515572



All times are GMT +1. The time now is 12:46 AM.

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