Numbers Only

  • Thread starter Thread starter Phil Hageman
  • Start date Start date
Phil,

Add this code to the worksheet code module

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("A1")) Is Nothing Then
If Not IsNumeric(Target) Then
Target.Value = Empty
End If
End If
End Sub

If A1 has a reference to another cell, it only allows this if the referenced
cell is numeric. However, changing the referenced cell to text doesn't get
trapped.
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top