Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi I have a macro which will carry out various commands but I would like line which states something like If Range("a1"). value istext then _ If Range("a1").value isnumber then _ Where the macro can tell if the user has inputted a non numeri character when a number is require -- Donki ----------------------------------------------------------------------- Donkin's Profile: http://www.excelforum.com/member.php...fo&userid=2371 View this thread: http://www.excelforum.com/showthread.php?threadid=37702 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() try If not Isnumeric(Range("A1").value) Then... 'not a number or If Isnumeric(Range("A1").value) Then... 'a number Ar -- HiAr ----------------------------------------------------------------------- HiArt's Profile: http://www.excelforum.com/member.php...fo&userid=1995 View this thread: http://www.excelforum.com/showthread.php?threadid=37702 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If the user types in '123 (with the leading quote), then is the cell numeric or
text? Try this against a test worksheet: Option Explicit Sub aa() Dim myCell As Range With ActiveSheet Set myCell = .Range("a1") With myCell .Value = "'123" MsgBox IsNumeric(.Value) & "--" & Application.IsNumber(.Value) .ClearContents MsgBox IsNumeric(.Value) & "--" & Application.IsNumber(.Value) End With End With End Sub application.isnumber is more stringent. Both an empty cell and '123 will come back as true using VBA's isnumeric. Donkin wrote: Hi I have a macro which will carry out various commands but I would like a line which states something like If Range("a1"). value istext then _ If Range("a1").value isnumber then _ Where the macro can tell if the user has inputted a non numeric character when a number is required -- Donkin ------------------------------------------------------------------------ Donkin's Profile: http://www.excelforum.com/member.php...o&userid=23715 View this thread: http://www.excelforum.com/showthread...hreadid=377020 -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Wouldn't it be better if you used Data Validation to prevent your users
entering the wrong response rather than testing for it after the event? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Replace Number with Text using Macro | Excel Discussion (Misc queries) | |||
Macro to change a number to text | Excel Programming | |||
macro adding a number to a number already in a cell | Excel Programming | |||
macro adding a number to a number already in a cell | Excel Programming | |||
macro adding a number to a number already in a cell | Excel Programming |