Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Single message box for multiple IF statements

I have three separate IF statemnts. Currently when they
are true, the following code is executed:

First IF statement

MsgBox "Please enter a Client Name"
Cancel = True

Second IF statement

MsgBox "Please enter a Sub Client"
Cancel = True

Third IF statement

MsgBox "Please enter a File Barcode"
Cancel = True


This produces three message boxes.

Is it possible to have one message box that shows the
statements that are true.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Single message box for multiple IF statements

First IF Statement
sText="Please enter a Client Name

2. If Statement
sText="Please enter a Sub Client"

3. IF Statement
sText="Please enter a File Barcode"

msgbox sText
Cancel=true
-----Original Message-----
I have three separate IF statemnts. Currently when they
are true, the following code is executed:

First IF statement

MsgBox "Please enter a Client Name"
Cancel = True

Second IF statement

MsgBox "Please enter a Sub Client"
Cancel = True

Third IF statement

MsgBox "Please enter a File Barcode"
Cancel = True


This produces three message boxes.

Is it possible to have one message box that shows the
statements that are true.

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Single message box for multiple IF statements

Simon,

msg = ""

IF 1st is true then msg = "Please enter a Client Name" &
(chr10)
IF 2nd is true then msg = msg & "Please enter a Sub
Client" & (chr10)
IF 3rd is true then msg = msg & "Please enter a Sub
Client" & (chr10)

msgbox msg

-----Original Message-----
I have three separate IF statemnts. Currently when they
are true, the following code is executed:

First IF statement

MsgBox "Please enter a Client Name"
Cancel = True

Second IF statement

MsgBox "Please enter a Sub Client"
Cancel = True

Third IF statement

MsgBox "Please enter a File Barcode"
Cancel = True


This produces three message boxes.

Is it possible to have one message box that shows the
statements that are true.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Single message box for multiple IF statements

Dim msg as String
msg = ""
If criteria1 then msg = msg & "Please enter a Client Name" & vbcrlf
if criteria2 then msg = msg & "Please enter a Sub Client" & vbCrLf
if critiera3 then msg = msg & "Please enter a file BarCode"
if msg < "" then
msgbox msg
End if

--
Regards,
Tom Ogilvy


"Simon" wrote in message
...
I have three separate IF statemnts. Currently when they
are true, the following code is executed:

First IF statement

MsgBox "Please enter a Client Name"
Cancel = True

Second IF statement

MsgBox "Please enter a Sub Client"
Cancel = True

Third IF statement

MsgBox "Please enter a File Barcode"
Cancel = True


This produces three message boxes.

Is it possible to have one message box that shows the
statements that are true.



  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Single message box for multiple IF statements

this solution worked great.

many thanks.


-----Original Message-----
Dim msg as String
msg = ""
If criteria1 then msg = msg & "Please enter a Client

Name" & vbcrlf
if criteria2 then msg = msg & "Please enter a Sub Client"

& vbCrLf
if critiera3 then msg = msg & "Please enter a file

BarCode"
if msg < "" then
msgbox msg
End if

--
Regards,
Tom Ogilvy


"Simon" wrote in

message
...
I have three separate IF statemnts. Currently when they
are true, the following code is executed:

First IF statement

MsgBox "Please enter a Client Name"
Cancel = True

Second IF statement

MsgBox "Please enter a Sub Client"
Cancel = True

Third IF statement

MsgBox "Please enter a File Barcode"
Cancel = True


This produces three message boxes.

Is it possible to have one message box that shows the
statements that are true.



.

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
Sumproduct, single criteria identified within multiple in single c Monte Excel Discussion (Misc queries) 4 July 18th 09 11:21 PM
Multiple formats in a single cell with multiple formulas Zakhary Excel Worksheet Functions 1 May 2nd 08 12:08 AM
Printing single pages from multiple worksheets in a single print job [email protected] Excel Discussion (Misc queries) 2 April 27th 07 06:11 PM
Find Multiple instances of Single Criterion in Row & Return To a Single Col Sam via OfficeKB.com Excel Worksheet Functions 16 May 10th 06 03:00 AM
how many if statements can i use in a single cell ? Kypreo Excel Worksheet Functions 5 November 23rd 05 09:23 PM


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