View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
IanC[_2_] IanC[_2_] is offline
external usenet poster
 
Posts: 157
Default Selection change code with merged cells

Happy new year everyone.

I have an issue with the code below and wondered if there was a way to get
round the problem.

The issue is that R11:S11 and R12:S12 are merged cells. With single cells,
the code toggles between a tick (Wingdings character 252) and blank when
each cell is selected. With merged cells nothing happens.

Is there a way to enable the code when the cells are merged?

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("R11:S12")
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
End With
sub_exit:
Application.EnableEvents = True
End Sub