ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   assign number value (https://www.excelbanter.com/excel-programming/290417-re-assign-number-value.html)

Bob Phillips[_6_]

assign number value
 
Tim,

This works on column 1

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo ws_exit
With Target
If .Column = 1 Then
If Not IsNumeric(.Value) Then
.Value = ""
End If
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub


Put it in the appropriate worksheet code module.

--

HTH

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

"Tim" wrote in message
...
I would like to make a column reject anything other than a number for the

column. If a word is put in there by a macro excel sees it is not a number
and replaces it with a 0 or blank.




All times are GMT +1. The time now is 08:55 PM.

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