In VBA, I need to check if the first letter of a character string in capitalized.
(I do NOT want to change its case, though)
e.g.,
var1 = "task"
Is the t capitalized?
I found the string function "exact()" and the information on it indicated that the string funciton is case-sensitive, so it can be used to test if the ltter cases are identical to the proper-case version of the string. Their example was checking cell A1.
=EXACT(A1,Proper(A1))
I tried:
If exact(var1,PROPER(var1)) ' this did not work
tried:
dim checkfirstchar as string
Checkfirstchar = exact(A1,Proper(A1)) " (function not defined)
Tried
dim checkfirstchar as string
If Checkfirstchar(exact(A1,Proper(A1))) then " (function not defined)
msgbox "if true, then capitalized)
end if
Your help would be so appreciated. I need this info urgently.
(I do NOT want to change its case, though)
e.g.,
var1 = "task"
Is the t capitalized?
I found the string function "exact()" and the information on it indicated that the string funciton is case-sensitive, so it can be used to test if the ltter cases are identical to the proper-case version of the string. Their example was checking cell A1.
=EXACT(A1,Proper(A1))
I tried:
If exact(var1,PROPER(var1)) ' this did not work
tried:
dim checkfirstchar as string
Checkfirstchar = exact(A1,Proper(A1)) " (function not defined)
Tried
dim checkfirstchar as string
If Checkfirstchar(exact(A1,Proper(A1))) then " (function not defined)
msgbox "if true, then capitalized)
end if
Your help would be so appreciated. I need this info urgently.
Last edited: