Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way not to consider an empty space as a "0"?
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What's the context? Is it in a formula? You can use ISEMPTY in VBA to
test for empty cells. Barb Reinhardt "Barbicane" wrote: Is there a way not to consider an empty space as a "0"? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way not to consider an empty CELL as a "0"?
Yes, just check. dim myCell as range set mycell = activesheet.range("a1") if isempty(mycell.value) then msgbox "It's empty!" elseif isnumeric(mycell.value) then msgbox "It looks like a number to VBA!" end if Another way: if application.isnumber(mycell.value) then 'it's a some sort of number for sure end if Barbicane wrote: Is there a way not to consider an empty space as a "0"? -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ps. VBA's isnumeric() behaves differently than Excel's =isnumber().
In excel, if you format a cell as text and then type 123 in it, then =isnumber() will return False. In VBA, if that string or value can be construed to look like a number, then isnumeric() will return true. Dave Peterson wrote: Is there a way not to consider an empty CELL as a "0"? Yes, just check. dim myCell as range set mycell = activesheet.range("a1") if isempty(mycell.value) then msgbox "It's empty!" elseif isnumeric(mycell.value) then msgbox "It looks like a number to VBA!" end if Another way: if application.isnumber(mycell.value) then 'it's a some sort of number for sure end if Barbicane wrote: Is there a way not to consider an empty space as a "0"? -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Replace "dash" with "space" | Excel Discussion (Misc queries) | |||
How do I put a "hard space" into text in a excel 2007 cell? | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Can I automatically add space after ea. row ("Space After" in Word | Excel Discussion (Misc queries) | |||
how do I type "itis" without Excel putting a space "it is"? | Excel Worksheet Functions |