View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_5_] Dana DeLouis[_5_] is offline
external usenet poster
 
Posts: 77
Default trimming whitespace

Just another similar option:

Sub Demo()

Dim s As String
s = "cat " & vbTab & " " & vbLf & vbTab & " " & vbCrLf & "dog"
s = Replace(WorksheetFunction.Clean(s), Space(1), vbNullString)

'// or
s = "cat " & vbTab & " " & vbLf & vbTab & " " & vbCrLf & "dog"
With WorksheetFunction
s = .Substitute(.Clean(s), Space(1), vbNullString)
End With

End Sub

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Jamie Martin" wrote in message
...
Can I trim all whitespace from a string, turning "cat<any number of

spaces,
plus if possible any number of tabsdog" into "catdog"?