ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trim function as a procedure - a simple example (https://www.excelbanter.com/excel-programming/365402-trim-function-procedure-simple-example.html)

[email protected]

Trim function as a procedure - a simple example
 
No question here, just a very simple example procedure for the archive

Sub RemoveAllBlankSpacesButOne()

'Removes all blank spaces = 2 and replaces
'them with just one blank space

Dim cell As Range
On Error Resume Next
For Each cell In Selection
cell.Value = WorksheetFunction.Trim(cell.Value)
Next cell

End Sub

Search critera:
Remove all spaces from a text string except for single spaces between
words and numbers
Remove continous blank spaces greater than two
Trim function as a procedure
Replace continous blank spaces with just one blank space
Trim down blank spaces to one space



All times are GMT +1. The time now is 04:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com