is there a #?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In my macro I get info from another program. If something has gone wrong then
the charachter # is found in the info. How can I write a short test to see if
that charachter is found in the info given? please help! thanks!
 
You can use InStr() to test for the presence of a character in a string:

Sub pound_test()
Dim s As String
s = "1234#5678"
If InStr(1, s, "#") > 0 Then
MsgBox ("Pound found")
End If
End Sub
 
If the_value Like "*#*" Then
... error

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top