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


Good Morning!

I have this code that checks 2 cells for data. If data is in cell A1,
but not B1 a message box pops up, "Cell B1 has no code". This part of
the code works fine.

If both cells has the information needed, how do I return a message box
that
says, "Check Sheet Sucessful".

I'm using a macro button on the sheet to check these conditions:

Code:

Sub Check_click()
If Range("A1").Value < "" And Range("B1").Value = "" Then
MsgBox "Please enter a code in the 1st box, under code in Special
Purpose Deposits. Click Ok and type General or Building!", 16,
"message"
Range("B1").Select
End If
If Range("A1").Value = "" And Range("B1").Value = "" Then
MsgBox "Successful!", 16, "message"
End If
End Sub

By the way, I don't get any errors. If B1 if left empty, I get the
first message box, and it goes to the cell. If I leave cell B1 blank,
then run the macro, nothing happens, the screen just blinks, like
something did.

Thanks,
EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=374525

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Checking cell for 2 conditions


I think your problem is that an empty cell does not have the value o
"". Maybe test for value of 0 (zero) if you are looking for an empt
cell

--
duan

-----------------------------------------------------------------------
duane's Profile: http://www.excelforum.com/member.php...fo&userid=1162
View this thread: http://www.excelforum.com/showthread.php?threadid=37452

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Checking cell for 2 conditions


Perhaps just this

Code:
--------------------

Sub Check_click()
If Range("A1").Value < "" And Range("B1").Value = "" Then
MsgBox "Please enter a code in the 1st box, under code in Special Purpose Deposits. Click Ok and type General or Building!", 16, "message"
Range("B1").Select
Else
MsgBox "Successful!", 16, "message"
End if
End Sub
--------------------


--
Norie
------------------------------------------------------------------------
Norie's Profile: http://www.excelforum.com/member.php...o&userid=19362
View this thread: http://www.excelforum.com/showthread...hreadid=374525

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Checking cell for 2 conditions


Thanks for the speedy replies!

I can see it now with your help. I tried Nories first, and it worked
Now I'll try Duane's for learning purposes.

Thanks,
EMo

--
EMo
-----------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...fo&userid=2318
View this thread: http://www.excelforum.com/showthread.php?threadid=37452

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Checking cell for 2 conditions

I think your problem is that an empty cell does not have the value of
"".


Activecell.ClearContents
? isempty(ActiveCell)
True
? ActiveCell.Value = ""
True
? activeCell.Value = 0
True

Guess it does have a value of "", but zero seems to work as well.

--
Regards,
Tom Ogilvy


"duane" wrote in
message ...

I think your problem is that an empty cell does not have the value of
"". Maybe test for value of 0 (zero) if you are looking for an empty
cell.


--
duane


------------------------------------------------------------------------
duane's Profile:

http://www.excelforum.com/member.php...o&userid=11624
View this thread: http://www.excelforum.com/showthread...hreadid=374525



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
Countif Conditions - Use of conditions that vary by cell value JonTarg Excel Discussion (Misc queries) 1 May 30th 08 01:21 PM
Spell Checking with checking cell notes jfitzpat Excel Discussion (Misc queries) 0 August 8th 07 10:26 PM
Checking cells for 2 conditions Mary Lancaster Excel Worksheet Functions 3 July 21st 07 11:34 PM
checking two conditions Tmian Excel Discussion (Misc queries) 5 August 9th 06 12:02 AM
Checking if 2 of 3 conditions are met... guilbj2 Excel Discussion (Misc queries) 5 June 29th 06 04:31 PM


All times are GMT +1. The time now is 07:05 AM.

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"