View Single Post
 
Old 01-31-2018, 02:36 PM
LearnerExcel LearnerExcel is offline Windows 7 32bit Office 2003
Advanced Beginner
 
Join Date: Nov 2016
Posts: 82
LearnerExcel will become famous soon enoughLearnerExcel will become famous soon enough
Default How to remove trailing & leading spaces in a cell?

How can I remove the trailing & leading spaces even if it is in brackets from the cell?
The following code is fine but for MS Access. How can I use the similar code in Excel to get the result?

Code:
Private Function Spaces(strText As String) As String
        Return String.Join(" ", strText.Split({" "}, StringSplitOptions.RemoveEmptyEntries)).Replace("( ", "(").Replace(" )", ")")
    End Function
Reply With Quote