Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Did evalution of empty cells change in Excel 2007?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Did evalution of empty cells change in Excel 2007?

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" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Did evalution of empty cells change in Excel 2007?

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Did evalution of empty cells change in Excel 2007?

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Did evalution of empty cells change in Excel 2007?

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
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
Change cells from starting Right to Left Excel 2007 yyzlhr Setting up and Configuration of Excel 8 April 4th 23 11:18 AM
fill down empty cells at every change in value Rose Excel Worksheet Functions 4 March 24th 09 03:03 PM
Evalution of a cell-entry Gilbert DE CEULAER Excel Worksheet Functions 10 December 5th 08 12:54 AM
How to change the color of selected cells in excel 2007 Selecting non-adjacent cells in Excel 07 Excel Discussion (Misc queries) 2 February 24th 07 09:10 PM
Excel - Autom. Filter "Empty / Non Empty cells" should come first Rom Excel Discussion (Misc queries) 0 August 10th 05 04:32 PM


All times are GMT +1. The time now is 12:31 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"