Thread: Numbers Only
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Numbers Only

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)

"Phil Hageman" wrote in message
...
I want allow numbers only entered in a cell, how do I go
about this?

Thanks,
Phil