I have a "simple" comparison that is generating a "Type mismatch" error when I delete a row in the worksheet (worksheet change event fires).
If Target.Column = gblScheduled And Target.Value = "Yes" Then
- I've checked the documentation and the
Columnproperty is Integer. - I have a global constant with an Integer data type for that comparison.
- I've checked the documentation and the
Valueproperty is a Variant. - As you can see, the literal would be a String value for that comparison.
VBA coercion should allow that. But, just in case, I did this:
If Target.Column = gblScheduled And Target.Value = CVar("Yes") Then
But that still resulted in a "Type mismatch". Why?
Target.Cells.Count > 1so that your code wont even try to run if there is more than one cell selected?Targetcan be more than one cell.Targethas >1 cell thenTarget.Valueis a 2D array, not a single value.