PC Review


Reply
Thread Tools Rate Thread

Did evalution of empty cells change in Excel 2007?

 
 
Gustaf
Guest
Posts: n/a
 
      21st Aug 2009
From trying my VBA app in both Excel 2003 and 2007, I came to the conclusion that 2007 seem to handle empty cells differently. The code looks something like this:

lngVolume = wsMySheet.Cells(iRow, iCell)

lngVolume is a Long. In Excel 2003, the right hand expression returns "", while in Excel 2007, it returns 0. Can anyone confirm this?

Gustaf
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      21st Aug 2009
It behaves identically for me.

The right-hand side does return null in both cases, but setting a long to
that value returns 0 in each case.

--
__________________________________
HTH

Bob

"Gustaf" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> From trying my VBA app in both Excel 2003 and 2007, I came to the
> conclusion that 2007 seem to handle empty cells differently. The code
> looks something like this:
>
> lngVolume = wsMySheet.Cells(iRow, iCell)
>
> lngVolume is a Long. In Excel 2003, the right hand expression returns "",
> while in Excel 2007, it returns 0. Can anyone confirm this?
>
> Gustaf



 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      21st Aug 2009
Assuming that A1 is empty:

Sub WhatIsIt()
Dim lngVolume As Long
lngVolume = Cells(1, 1).Value
MsgBox (lngVolume)
End Sub

displays 0 in both versions
--
Gary''s Student - gsnu200901


"Gustaf" wrote:

> From trying my VBA app in both Excel 2003 and 2007, I came to the conclusion that 2007 seem to handle empty cells differently. The code looks something like this:
>
> lngVolume = wsMySheet.Cells(iRow, iCell)
>
> lngVolume is a Long. In Excel 2003, the right hand expression returns "", while in Excel 2007, it returns 0. Can anyone confirm this?
>
> Gustaf
>

 
Reply With Quote
 
Paul Martin
Guest
Posts: n/a
 
      26th Aug 2009
Gustaf

Make sure you declare the variable lngVolume, ie

Dim lngVolume as Long

Then it should return 0 regardless. If you're getting "", it suggests
you haven't declared the variable's data type (ie, Long).

Paul Martin
Melbourne, Australia

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      26th Aug 2009
If that cell contained a formula that evaluated to ="", then you'll see this.

If the cell with that formula was converted to values, then you'll see this.

But that cell isn't empty.

Select the cell, hit the delete key (or clearcontents) and try the code once
more.

Gustaf wrote:
>
> From trying my VBA app in both Excel 2003 and 2007, I came to the conclusion that 2007 seem to handle empty cells differently. The code looks something like this:
>
> lngVolume = wsMySheet.Cells(iRow, iCell)
>
> lngVolume is a Long. In Excel 2003, the right hand expression returns "", while in Excel 2007, it returns 0. Can anyone confirm this?
>
> Gustaf


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do I get rounding errors in Excel 2007 on empty cells? RonaldK Microsoft Excel Crashes 1 16th Jan 2010 01:26 PM
Change cells from starting Right to Left Excel 2007 =?Utf-8?B?eXl6bGhy?= Microsoft Excel Setup 5 13th Jan 2010 08:44 AM
Can I change the appearance of Selected active cells in Excel 2007 Knut J Dahl Microsoft Excel Misc 0 30th Apr 2009 10:09 AM
Excel 2007 - change shading when selecting groups of cells tomfabtastic@hotmail.com Microsoft Excel Misc 1 7th Apr 2008 03:58 AM
How to change the color of selected cells in excel 2007 =?Utf-8?B?U2VsZWN0aW5nIG5vbi1hZGphY2VudCBjZWxscyBp Microsoft Excel Misc 2 24th Feb 2007 09:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:38 AM.