Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 -- |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've sorted it. It appears to be yet another inconsistency between
Excel versions where certain actions in Excel 2010 will not work on a protected worksheet even though they work perfectly on a protected sheet in Excel 2000. In my code below I have wrapped the font change line in unprotect/protect commands as below: Worksheets("Service Report").Unprotect .Font.Name = "Wingdings" Worksheets("Service Report").Protect -- Ian -- "IanC" wrote in message ... 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 -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
2010 date in Excel 2000 | Excel Discussion (Misc queries) | |||
2010 in Excel 2000 | Excel Discussion (Misc queries) | |||
VBA Code works in Excel 2003 but won't work in Excel 2000 | Excel Programming | |||
VBA Code works in Excel 2003 but won't work in Excel 2000 | Excel Programming | |||
Why won't this Excel 2000 code work for Excel '97? | Excel Programming |