I have a var="sssssss yutyutyu b "
how to eliminate a blank space and reain only one?
I remember is possible with excel.application but not remember the rest of code
eliminate blank in string
-
- Administrator
- Posts: 78513
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: eliminate blank in string
Code: Select all
Dim varS As String
varS = "sssssss yutyutyu b "
' Remove leading spaces, trailing spaces and replace multiple spaces with single ones
varS = Application.WorksheetFunction.Trim(varS)
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4357
- Joined: 26 Apr 2010, 17:36
Re: eliminate blank in string
yeah!!!!!!HansV wrote:Code: Select all
Dim varS As String varS = "sssssss yutyutyu b " ' Remove leading spaces, trailing spaces and replace multiple spaces with single ones varS = Application.WorksheetFunction.Trim(varS)
Work fine.