Ucase function is to converted String from Lowercase to Uppercase or big capital letters for example your text String is "My Name" then returns "MY NAME".
Syntax : Ucase(String) , Returns : Uppercase String
VBA Vode:
Option Explicit
Sub Examples_Ucasefunction()
Dim StrTxtA As String, StrTxtB As Variant
StrTxtA = "My Car Number PRS123"
StrTxtB = Null
Debug.Print UCase(StrTxtA) ' MY CAR NUMBER PRS123
Debug.Print UCase(StrTxtB) ' Null
End Sub
Sub Examples_Ucasefunction()
Dim StrTxtA As String, StrTxtB As Variant
StrTxtA = "My Car Number PRS123"
StrTxtB = Null
Debug.Print UCase(StrTxtA) ' MY CAR NUMBER PRS123
Debug.Print UCase(StrTxtB) ' Null
End Sub
Note:
For Null consider not string even we use Ucase on Null it will remain unchanged. This function is very useful when we try to compare or find String inside String and we wish to ignore the case letters by forcing both String either Ucase or LCase before compare.
excel training online, visual basic for applications at below links.
Microsoft Reference-Ucase-function
Other Reference-Ucase-function
Leave your comments if you have any request.
Practice makes perfect.
Thank You.
No comments:
Post a Comment