Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Rabiah Begum    on Mar 15 In MS Office Category.

  
Question Answered By: Ryan Evans   on Mar 15

You want to validate the cell  contents, doing nothing if valid, but
executing MY_FUNCTION if not?

Sub blah()
valid = True
For i = 1 To Len(ActiveCell.Value)
cch = Mid(ActiveCell.Value, i, 1)
If InStr("1234567890-", cch) = 0 Then valid = False: Exit For
Next i
If Not valid Then MY_FUNCTION
End Sub

This can be easily edited to check  for the presence of only those
characters within the double quote marks.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on check for digit & hyphen Or get search suggestion and latest updates.


Tagged: