VBA – RTrim String
The RTrim function in VBA is used to remove any trailing spaces (spaces at the end) from a string.
RTrim
Syntax:
RTrim(string)
Parameter:
Return Value:
Example
Dim str1 As String Dim trimmedStr As String str1 = "Hello, World! " trimmedStr = RTrim(str1) ' trimmedStr will be "Hello, World!"
Use Cases:
Key Considerations:
Trim