ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine whether a character is Upper or Lower case (https://www.excelbanter.com/excel-programming/347190-determine-whether-character-upper-lower-case.html)

[email protected]

Determine whether a character is Upper or Lower case
 
Is there a function that will allow me to determine if a character is
either Upper or Lower Case? If not, any idea how I can build one in
VBA?


Jim Thomlinson[_4_]

Determine whether a character is Upper or Lower case
 
give this function a try

public function IsUpperCase(byval InputString as string) as boolean
if ucase(inputstring) = inputstring then
IsUpperCase = true
else
IsUpperCase = false
end if
end function
--
HTH...

Jim Thomlinson


" wrote:

Is there a function that will allow me to determine if a character is
either Upper or Lower Case? If not, any idea how I can build one in
VBA?



Dave Peterson

Determine whether a character is Upper or Lower case
 
One character in A1?

=if(exact(a1),upper(a1)),"upper","not upper")

But you'll have to add a couple of checks if there's a possibility of
non-alphabetic characters in that cell.

=IF(LEN(A1)<1,"Too many chars",
IF(OR(CODE(LOWER(A1))<CODE("a"),CODE(LOWER(A1))CO DE("z")),"not alpabetic",
IF(EXACT(A1,UPPER(A1)),"upper","Lower")))

All one cell.

wrote:

Is there a function that will allow me to determine if a character is
either Upper or Lower Case? If not, any idea how I can build one in
VBA?


--

Dave Peterson


All times are GMT +1. The time now is 10:55 PM.

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