View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
IanC[_2_] IanC[_2_] is offline
external usenet poster
 
Posts: 157
Default Code in Excel 2000 template doesn't work in Excel 2010

I have the following code working as expected in Excel 2000. It is
designed to populate a cell in column Q with a tick OR a cell in
column S with a cross.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----- ENABLE TICKS IN RELEVANT BOXES -----
Application.EnableEvents = False
On Error GoTo sub_exit
If Not Intersect(Target, Range("Q18:Q19")) Is Nothing Then
With Target
If .Value = Chr(252) Then
.Value = ""
Else
.Value = Chr(252)
.Font.Name = "Wingdings"
Range("S" & ActiveCell.Row & "").Value = ""
End If
End With
End If
If Not Intersect(Target, Range("S18:S19")) Is Nothing Then
With Target
If .Value = Chr(251) Then
.Value = ""
Else
.Value = Chr(251)
.Font.Name = "Wingdings"
Range("Q" & ActiveCell.Row & "").Value = ""
End If
End With
End If
sub_exit:
Application.EnableEvents = True
End Sub



In Excel 2010 the exclusivity doesn't work (ie it will generate an
tick AND a cross on the same line). If I remove the "On Error" line In
Excel 2010, an error is generated on the line:

..Font.Name = "Wingdings"

The error is "Run-time error '1004': Unable to set the Name property
of the Font class". Excel 2010 VBA editor offers Name as an option to
follow Font suggesting the combination Font.Name is acceptable.

Any ideas why this is happening?

--
Ian
--