Be the first user to complete this post
|
Add to List |
VBA-Excel: String Functions – Trim()
Description:
The Trim function removes spaces on the left and right side of a string.
Format:
Trim (strMainString)
Arguments:
- strMainString
- Mandatory
- Type: String
- String whose both side spaces needs to be trimmed.
Function FnTrim() Dim strMainString strMainString = " Sumit Jain " MsgBox "Hello" & Trim(strMainString) & "Trimmed both sides." End Function
![Trim](/static/media/excel/2013/05/Trim.jpg)
Also Read About Other String() Functions
INSTR() | InstrREV() | LCase()
Also Read:
- VBA-Excel: Array Functions – LBound and UBound()
- VBA-Excel: Array Functions – Filter()
- VBA-Excel: String Functions – Space()
- VBA-Excel: Date-Time Functions – Date(), Now() and Time()
- VBA-Excel: String Functions – Mid()