Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Empty space as "zero"

Is there a way not to consider an empty space as a "0"?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Empty space as "zero"

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Empty space as "zero"

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Empty space as "zero"

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace "dash" with "space" Turkey Excel Discussion (Misc queries) 2 April 30th 09 11:31 PM
How do I put a "hard space" into text in a excel 2007 cell? Tom S Excel Discussion (Misc queries) 2 September 24th 08 04:26 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Can I automatically add space after ea. row ("Space After" in Word Reddheddz Excel Discussion (Misc queries) 0 June 17th 08 05:55 PM
how do I type "itis" without Excel putting a space "it is"? Max Excel Worksheet Functions 4 March 18th 07 10:22 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"