View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Flower Flower is offline
external usenet poster
 
Posts: 6
Default Going through a string, a char at a time.

Hi,

It's not very pretty but it works for me;

Sub removechar()

Dim i, l As Integer
Dim mystr1, mystr2 As String

mystr1 = "how to remove ' from a string"
l = Len(mystr1)

For i = 1 To l
If Mid(mystr1, i, 1) < "'" Then
mystr2 = mystr2 & Mid(mystr1, i, 1)
End If
Next i

End Sub

Ammend to sub or UDf as neccessary.
Hopefully someone else will have a sexier solution!


"NateBuckley" wrote:

Hello is it possible to go through a String checking for certain characters?

Basically want to somehow convert a String to a character array and go
through it checking for the ' character. Or failing that, is there a function
that disposes of certain characters within a string.

Cheers.

Nate