I am working on a simple spreadsheet that changes characters when you click on the cell, then counts the cells that are of a certain character. I have set the range to only look at certain cells (A3:A27, B3:B27) but anytime I click on row 1 (Row with several merged cells) or select multiple cells that are outside of the defined range I get a Runtime Error 13. Here is my code. Thank you in advance for the help!!
<code>Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Set rng = Range("A3:A27,B3:B27")
If Target.Value = Chr(254) Then
Target.Value = Chr(168)
Cancel = True
ElseIf Target.Value = Chr(168) Then
Target.Value = Chr(254)
Cancel = True
End If
End Sub
</code>
<code>Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Set rng = Range("A3:A27,B3:B27")
If Target.Value = Chr(254) Then
Target.Value = Chr(168)
Cancel = True
ElseIf Target.Value = Chr(168) Then
Target.Value = Chr(254)
Cancel = True
End If
End Sub
</code>