ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Numbers Only (https://www.excelbanter.com/excel-programming/285272-numbers-only.html)

Phil Hageman[_3_]

Numbers Only
 
I want allow numbers only entered in a cell, how do I go
about this?

Thanks,
Phil

Jim Rech

Numbers Only
 
Have a look at Data, Validation. Just what the doctor ordered!

--
Jim Rech
Excel MVP



Bob Phillips[_6_]

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





All times are GMT +1. The time now is 01:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com