Anne Troy
MrExcel MVP
- Joined
- Feb 18, 2002
- Messages
- 2,632
- Office Version
- 365
- Platform
- Windows
I have a named range called inout. If someone enters a zero into any cell in that range, I want the format of the cell to be converted to number. The current format is time. This does nothing:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 0 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "inout" Then
If Target.Value = "0" Then
Target.NumberFormat = "0"
' On Error GoTo 0
End If
End If
End Sub