Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default if statement

hi does anybody know why this doesn't work

If IsNull("a6") = True Then
MsgBox "Error"
Exit Sub
End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default if statement

Works for me.

The string "a6" isn't Null, so the instructions between Then and End If
are skipped.

It's also nearly impossible to tell what you mean by "doesn't work".
What are you trying to do?


In article ,
"ashw1984" wrote:

hi does anybody know why this doesn't work

If IsNull("a6") = True Then
MsgBox "Error"
Exit Sub
End If

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default if statement

sorry i want the statement the throw up an error messageand stop the macro,
if a6 is empty
if a6 isn't then i would like it to continue with the macro

"JE McGimpsey" wrote:

Works for me.

The string "a6" isn't Null, so the instructions between Then and End If
are skipped.

It's also nearly impossible to tell what you mean by "doesn't work".
What are you trying to do?


In article ,
"ashw1984" wrote:

hi does anybody know why this doesn't work

If IsNull("a6") = True Then
MsgBox "Error"
Exit Sub
End If


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default if statement

if isempty(worksheets("sheet99").range("a6")) then

or

if worksheets("sheet99").range("a6").value = "" then

or

if trim(worksheets("sheet99").range("a6").value) = "" then

Each test different things. The first if there's really nothing (not even a
formula) in the cell.

The second test if the cell is empty or has a formula that evaluates to ""
(like: =if(a11,"","ok") or if it has a zero length text in that cell (like an
apostrophe (')).

The third does the same thing as the second, but also checks for just space
characters, too--like:

=if(a11," ","ok")



ashw1984 wrote:

sorry i want the statement the throw up an error messageand stop the macro,
if a6 is empty
if a6 isn't then i would like it to continue with the macro

"JE McGimpsey" wrote:

Works for me.

The string "a6" isn't Null, so the instructions between Then and End If
are skipped.

It's also nearly impossible to tell what you mean by "doesn't work".
What are you trying to do?


In article ,
"ashw1984" wrote:

hi does anybody know why this doesn't work

If IsNull("a6") = True Then
MsgBox "Error"
Exit Sub
End If



--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default if statement

One way:

If IsEmpty(Range("A6").Value) Then
MsgBox "Error"
Exit Sub
End If


In article ,
"ashw1984" wrote:

sorry i want the statement the throw up an error messageand stop the macro,
if a6 is empty
if a6 isn't then i would like it to continue with the macro

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 statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM
Help please, IF statement/SUMIF statement Brad_A Excel Worksheet Functions 23 January 11th 05 02:24 PM


All times are GMT +1. The time now is 09:53 PM.

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"