View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Bill Renaud Bill Renaud is offline
external usenet poster
 
Posts: 417
Default "Or" statement not working

Hi Chris,

Sounds like you are still having basic logic problems. In this situation, I
normally revert back to a "truth table" concept to sort out all of the
combinations before attempting to write the program. It would be something
like this (using 'short-form' notation):

Situation Action
---------------------- --------
Q44.Value="Fill in..." MsgBox
F47 is empty MsgBox
H56 is empty MsgBox
F47.Value=AB2.Value Do macro
H56.Value=AH2.Value Do macro

Remember that empty cells are considered to be 0, so if F47 is empty
(hasn't been filled in by the user yet) and AB2 =0, then they will be
considered equal by Excel. Complete the table as I have suggested above and
post it here, then we'll be able to fix the logic.

I'm suspecting that you probably need a separate If statement to check the
value of Q44 first and display the MsgBox, regardless of the state of the
other 2 cells. The situation with the other 2 cells (F47 and H56) is
probably more complex. You might need a separate Boolean variable to keep
track of everything, then finally show the MsgBox and exit if the Boolean
variable (blnShowMsgBox?) is TRUE.

--
Regards,
Bill Renaud