ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   is text capital (https://www.excelbanter.com/excel-programming/340420-text-capital.html)

Dave B[_3_]

is text capital
 
I'd like to use VBA to determine if the text in strMyString is all capital
(upper case) letters, but I'm not sure how. Any ideas?



Norman Jones

is text capital
 
Hi Dave,

Try:

'====================
Function IsAllUcase(sStr) As Boolean
IsAllUcase = sStr = UCase(sStr)
End Function
'<<====================

'====================
Public Sub TestIt()
Dim Arr As Variant
Dim i As Long

Arr = Array("abc", "ABc", "ABC")

For i = LBound(Arr) To UBound(Arr)

Debug.Print Arr(i), IsAllUcase(Arr(i))
Next
End Sub

'<<====================


---
Regards,
Norman



"Dave B" wrote in message
...
I'd like to use VBA to determine if the text in strMyString is all capital
(upper case) letters, but I'm not sure how. Any ideas?





Ian

is text capital
 
If UCase(strMyString) = strMyString Then ....

--
Ian
--
"Dave B" wrote in message
...
I'd like to use VBA to determine if the text in strMyString is all capital
(upper case) letters, but I'm not sure how. Any ideas?






All times are GMT +1. The time now is 11:27 AM.

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