Test for Error in cells
Does this code do what you want?
a1$ = Mid(Range("a1").Text, 2, 1)
b1$ = Mid(Range("b1").Text, 3, 1)
If a1$ Like "#" And b1$ Like "#" Then
MsgBox "Two numbers"
Else
MsgBox "Error"
End If
If not, I think you will need to provide more information about what is in
A1 and B1 and what you actually want to do with them.
--
Rick (MVP - Excel)
"LeeL" wrote in message
...
I am trying to test for letters or numbers within a cell.
I cannot get the Iserror to work correctly, nonerror is ok, but if it is
an
error, i cannot get True, i get a VBA error.
Can someone please help?
a1$ = Mid(Range("a1").Text, 2, 1)
b1$ = Mid(Range("b1").Text, 3, 1)
If IsError(a1 * b1) Then
MsgBox "error"
Else: MsgBox "nonerror"
End If
|