View Single Post
  #7   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


"Ryan H" wrote in message
...
Yes, I got the same issue. Excel automatically closes when the code is
executed when using .Value2(1,1), WEIRD, must be a bug. Is Sheet1 the
sheet
you have this code in? I did this and didn't have any issues.

I also shorten your code by not using a variable, but if you need to use
the
rTick variable, then I would suggest you declare you variables. For
example
rTick needs to be declared as a Range. I would recommend putting Option
Explicit at the top of each of your modules to ensure you don't have any
undeclared variables which can make your code very difficult to debug.

Hope this helps! If so, let me know, click "YES" below.

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----- ENABLE TICKS IN RELEVANT BOXES -----

If Not Intersect(Target, Range("R11:S12")) 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 Sub

--
Cheers,
Ryan


Thanks Ryan. That works, though I do need the variable in there as the range
varies depending on the content of a specific cell.

Bernie's version of the code is perfect. I just need to incorporate it into
my original workbook, but that won't be until tomorrow.

--
Ian
--