ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Message Box (https://www.excelbanter.com/excel-discussion-misc-queries/53076-message-box.html)

James Hamilton

Message Box
 
Hi,

I want a message box to appear (VB OKonly) if the value of a cell is either
Yes or No.

My code is:

Range("A1").Select
If ("A1") = "Yes" Then

MsgBox "THE REPORTS HAVE BEEN UPDATED", , "INFORMATION"

End If

Note: the Yes or No is selected using a data validation list.

HELP! Thanks


Norman Jones

Message Box
 
Hi James,

Change:

If ("A1") = "Yes" Then


to:

If Range("A1") = "Yes" Then


BTW it is rarely necessary or desirable to make selections. Therefore, you
could dispense with the line:

Range("A1").Select


---
Regards,
Norman



"James Hamilton" wrote in message
...
Hi,

I want a message box to appear (VB OKonly) if the value of a cell is
either
Yes or No.

My code is:

Range("A1").Select
If ("A1") = "Yes" Then

MsgBox "THE REPORTS HAVE BEEN UPDATED", , "INFORMATION"

End If

Note: the Yes or No is selected using a data validation list.

HELP! Thanks





All times are GMT +1. The time now is 11:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com