Problem with Worksheet_SelectionChange

I

IanC

I have a problem with the following code. I've cut it down to remove a bunch
of conditions defining rTick, but the problem I have is with the actual code
to change the cells.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----- ENABLE TICKS IN RELEVANT BOXES -----
Application.EnableEvents = False
On Error GoTo sub_exit
With Worksheets("Sheet1")
Set rTick =
Worksheets("Sheet1").Range("AE9:AE10,Q11:S13,Q22:Q25,S30:W40,AA17:AE38")
'--------Problem with this bit!!
If Not Intersect(Target, rTick) Is Nothing Then
With Target.Cells(1, 1)
If .Value = Chr(252) Then
.Value = ""
Else
.Value = Chr(252)
.Font.Name = "Wingdings"
End If
End With
End If
'--------
End With
sub_exit:
Application.EnableEvents = True
End Sub

Another part of my code copies named ranges from another sheet into Sheet1.
If the destination of the named range includes one or more of the cells in
rTick, the top left cell of the destination is overwritten with a tick.

For example, a named range is copied into Y6. It extends down and right to
AE11. As AE9 & AE10 are within the copied range, Y6 shows a tick.

If I substitute the following code, the problem goes away.

If Not Intersect(Target, rTick) Is Nothing Then
With Target
If .Value = Chr(252) Then
.Value = ""
Else
.Value = Chr(252)
.Font.Name = "Wingdings"
End If
End With
End If

The problem I have with this code is that some of the places I want ticks to
be produced are merged cells. Any idea how I can overcome this problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top