PDA

View Full Version : [SOLVED:] stripChar is not working



selfteaching
03-22-2019, 04:45 PM
Hi


I can’t see why I’m getting #NAME? with the following

=StripChars(BL18)
BL18 has $B$14
which is a result of a vlookup

It works on a different sheet

mike

Kenneth Hobs
03-22-2019, 05:34 PM
Maybe because that is not a built-in function nor do you have it coded as a UDF?

selfteaching
03-22-2019, 05:58 PM
Hi Ken

Yep I forgot that I was given a public function with it for the other workbook

Public Function StripChars(InputStr As String) As String
Dim i As Integer, Nstr As String, Tstr As String
For i = 1 To Len(InputStr)
If (Asc(Mid(InputStr, i, 1)) >= 65 And Asc(Mid(InputStr, i, 1)) <= 90) Or _
(Asc(Mid(InputStr, i, 1)) >= 97 And Asc(Mid(InputStr, i, 1)) <= 122) Then
Tstr = Tstr & Mid(InputStr, i, 1)
GoTo below
End If
If IsNumeric(Mid(InputStr, i, 1)) Then
Nstr = Nstr & Mid(InputStr, i, 1)
End If
below:
Next i
StripChars = Tstr & " " & Nstr
End Function
probably too many :beerchug:

Have one on me


mike