Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hey chaps,
just a quick question i am trying to write a VBA macro and i was just wondering if there was any way i could identify a cell if its content is a number: e.g. if cell.value = isanumber then do this else do this end if any help would be very much appreciated the noob |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
You could do this Set cell = Range("A1") If IsNumeric(cell.Value) Then 'do this MsgBox "Number" Else MsgBox "Not number" 'do this End If Mike "Noob McKnownowt" wrote: hey chaps, just a quick question i am trying to write a VBA macro and i was just wondering if there was any way i could identify a cell if its content is a number: e.g. if cell.value = isanumber then do this else do this end if any help would be very much appreciated the noob |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
good man
cheers pal noob "Mike H" wrote: Hi, You could do this Set cell = Range("A1") If IsNumeric(cell.Value) Then 'do this MsgBox "Number" Else MsgBox "Not number" 'do this End If Mike "Noob McKnownowt" wrote: hey chaps, just a quick question i am trying to write a VBA macro and i was just wondering if there was any way i could identify a cell if its content is a number: e.g. if cell.value = isanumber then do this else do this end if any help would be very much appreciated the noob |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just to add to Mike's response...
VBA's IsNumeric is very forgiving. If a string looks a number, then VBA's IsNumeric will give you a true. Excel's =isnumber() is much more stringent: msgbox isnumeric("1E5") msgbox application.isnumber("1E5") Noob McKnownowt wrote: hey chaps, just a quick question i am trying to write a VBA macro and i was just wondering if there was any way i could identify a cell if its content is a number: e.g. if cell.value = isanumber then do this else do this end if any help would be very much appreciated the noob -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Counting numbers | Excel Discussion (Misc queries) | |||
Counting Numbers | Excel Worksheet Functions | |||
counting numbers | Excel Discussion (Misc queries) | |||
counting numbers | Excel Discussion (Misc queries) | |||
Counting numbers | Excel Discussion (Misc queries) |