Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default If A cell Is null Do Nothing.

Hello All:
Assuming I have several functions that are all dependent on a cell,
lets say A2 to have a value, by value I mean not null(Value could be
Alpha or numeric). How would I do a condition that if cell A2 or for
that fact a range A2:A43 is null give a message with OK option and do
nothing.

Regards
Ardy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default If A cell Is null Do Nothing.

Thanks........
If i do This I won't get any result
Sub CellEmpty()
If IsEmpty(Range("A2:A5")) Then
MsgBox ("You Have An Empty Cell")
End If

If i do this then I get the msg box.
Sub CellEmpty()
If IsEmpty(Range("A2")) Then
MsgBox ("You Have An Empty Cell")
End If

Why the range dosn't work

JLatham (removethis) wrote:
If IsEmpty(Range("Z5")) then
'it has nothing in it, i.e. is null
End IF
or
If Not(IsEmpty(ActiveCell)) Then
'ActiveCell contains something
End IF

So, check out IsEmpty in VBA Help?

"Ardy" wrote:

Hello All:
Assuming I have several functions that are all dependent on a cell,
lets say A2 to have a value, by value I mean not null(Value could be
Alpha or numeric). How would I do a condition that if cell A2 or for
that fact a range A2:A43 is null give a message with OK option and do
nothing.

Regards
Ardy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default If A cell Is null Do Nothing.

You have to test each cell in the range.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Ardy" wrote in message
ups.com...
Thanks........
If i do This I won't get any result
Sub CellEmpty()
If IsEmpty(Range("A2:A5")) Then
MsgBox ("You Have An Empty Cell")
End If

If i do this then I get the msg box.
Sub CellEmpty()
If IsEmpty(Range("A2")) Then
MsgBox ("You Have An Empty Cell")
End If

Why the range dosn't work

JLatham (removethis) wrote:
If IsEmpty(Range("Z5")) then
'it has nothing in it, i.e. is null
End IF
or
If Not(IsEmpty(ActiveCell)) Then
'ActiveCell contains something
End IF

So, check out IsEmpty in VBA Help?

"Ardy" wrote:

Hello All:
Assuming I have several functions that are all dependent on a cell,
lets say A2 to have a value, by value I mean not null(Value could be
Alpha or numeric). How would I do a condition that if cell A2 or for
that fact a range A2:A43 is null give a message with OK option and do
nothing.

Regards
Ardy





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default If A cell Is null Do Nothing.

Or you could use:

if application.counta(range("a2:a5")) = 0 then
'all empty
else
'at least one cell has something in it
end if



Ardy wrote:

Thanks........
If i do This I won't get any result
Sub CellEmpty()
If IsEmpty(Range("A2:A5")) Then
MsgBox ("You Have An Empty Cell")
End If

If i do this then I get the msg box.
Sub CellEmpty()
If IsEmpty(Range("A2")) Then
MsgBox ("You Have An Empty Cell")
End If

Why the range dosn't work

JLatham (removethis) wrote:
If IsEmpty(Range("Z5")) then
'it has nothing in it, i.e. is null
End IF
or
If Not(IsEmpty(ActiveCell)) Then
'ActiveCell contains something
End IF

So, check out IsEmpty in VBA Help?

"Ardy" wrote:

Hello All:
Assuming I have several functions that are all dependent on a cell,
lets say A2 to have a value, by value I mean not null(Value could be
Alpha or numeric). How would I do a condition that if cell A2 or for
that fact a range A2:A43 is null give a message with OK option and do
nothing.

Regards
Ardy



--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default If A cell Is null Do Nothing.

John, Dave
Thank You for your help., Dave I have used your sujjestion for the
range with a bit of modification, works fine.

Much Regards

Dave Peterson wrote:
Or you could use:

if application.counta(range("a2:a5")) = 0 then
'all empty
else
'at least one cell has something in it
end if



Ardy wrote:

Thanks........
If i do This I won't get any result
Sub CellEmpty()
If IsEmpty(Range("A2:A5")) Then
MsgBox ("You Have An Empty Cell")
End If

If i do this then I get the msg box.
Sub CellEmpty()
If IsEmpty(Range("A2")) Then
MsgBox ("You Have An Empty Cell")
End If

Why the range dosn't work

JLatham (removethis) wrote:
If IsEmpty(Range("Z5")) then
'it has nothing in it, i.e. is null
End IF
or
If Not(IsEmpty(ActiveCell)) Then
'ActiveCell contains something
End IF

So, check out IsEmpty in VBA Help?

"Ardy" wrote:

Hello All:
Assuming I have several functions that are all dependent on a cell,
lets say A2 to have a value, by value I mean not null(Value could be
Alpha or numeric). How would I do a condition that if cell A2 or for
that fact a range A2:A43 is null give a message with OK option and do
nothing.

Regards
Ardy



--

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
If cell not null use that value Neall Excel Worksheet Functions 1 May 7th 09 07:55 PM
Failed to save table attributes of (null) into (null). Luca Brasi Excel Discussion (Misc queries) 2 February 4th 09 04:30 PM
Sum a NULL cell ArcticWolf Excel Worksheet Functions 6 December 4th 08 02:04 PM
cell value based on null/not null in another cell spence Excel Worksheet Functions 1 February 18th 06 11:49 PM
Cell not null value? ddwebb Excel Programming 1 May 3rd 04 08:56 PM


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