-
Hey guys, I am having trouble with this function:
_________________
Function DelState(c As Object)
Dim x1, y1 As Integer
x1 = 1
y1 = 10
Do
If c.Text <> "CT" Or "DC" Or "IN" Or "MA" Or "MD" Or "ME" Or "MI" Or "NH" Or "NJ" Or "OH" Or "PA" Or "RI" Or "VT" Or "WI" Or "WVA" Then
Call DeleteRow(x1, y1)
End If
x1 = x1 + 1
Loop Until x1 = maxrows + 1
End Function
__________________
I have an excel worksheet as an object and I am trying to test for the text not the values in a cell. But c.text gives me a type error.
What shall i do.
P.S. The rest of the prog works fine...
-
Maybe the cells are formatted as numbers not text, that would explain why you would get a
type mismatch error. But this is just a wild guess.
-
The problem is in your compare statement... you need to try it this way...
if c.Text <> "CT" and c.Text<> "DC" and c.Text <> "IN" ... etc...
You are getting a type mismatch because you are doing a logical statment (c.Text <> "CT") and then you are doing a logical OR with a string.
Bash