Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Test for empty cell

Hi!

I have a sheet, where I have a list of integers - if present - the
field might be empty.
How do I detect whether it is empty?

Using
r = MyFile.Sheets(1).Cells(i, 4)
and later using r cuases problems, I'd like to set it to -1 in cases
where it is empty.

I get the file from elswhere, the contest of it is unknown

BR
Sonnich

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Test for empty cell

Try

If MyFile.Sheets(1).Cells(i, 4) = "" Then
r = -1
Else
r = MyFile.Sheets(1).Cells(i, 4)
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Sonnich" wrote in message
ups.com...
Hi!

I have a sheet, where I have a list of integers - if present -
the
field might be empty.
How do I detect whether it is empty?

Using
r = MyFile.Sheets(1).Cells(i, 4)
and later using r cuases problems, I'd like to set it to -1 in
cases
where it is empty.

I get the file from elswhere, the contest of it is unknown

BR
Sonnich



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Test for empty cell

Restarting it was a good idea... it worked :-)

If MyFile.Sheets(1).Cells(i, 3).Text < "" Then



Sonnich wrote:
Hi!

I have a sheet, where I have a list of integers - if present - the
field might be empty.
How do I detect whether it is empty?

Using
r = MyFile.Sheets(1).Cells(i, 4)
and later using r cuases problems, I'd like to set it to -1 in cases
where it is empty.

I get the file from elswhere, the contest of it is unknown

BR
Sonnich


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
IF function to test whether the cell value is equal to empty nest terb Excel Worksheet Functions 1 April 30th 08 06:05 AM
How can I test if a cell is empty? Victor Delta Excel Discussion (Misc queries) 10 August 8th 07 11:22 PM
test expression for empty cell in =SUMIF() fgrose Excel Worksheet Functions 12 July 16th 07 04:52 PM
Test for empty row MahrYon Excel Programming 2 October 23rd 05 02:16 PM
Test if Cell is Empty or Doesn't Exist scott Excel Programming 2 February 7th 05 10:49 PM


All times are GMT +1. The time now is 11:03 AM.

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

About Us

"It's about Microsoft Excel"