ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   IF NOT or IS NOT function (https://www.excelbanter.com/excel-discussion-misc-queries/32776-if-not-not-function.html)

Nick Wright

IF NOT or IS NOT function
 
I am trying to write a macro to display a message if a certain cell does not
contain certain data. (I am working in Visual Basic)

i.e
If cell F1 = 100 then end
If cell F1 is not 100 then display a message "please re-enter data"

Can anyone please help

Anne Troy

You don't need a macro for that, Nick. Try this:
http://www.officearticles.com/excel/...soft_excel.htm
*******************
~Anne Troy

www.OfficeArticles.com
www.MyExpertsOnline.com


Nick Wright" wrote in message
...
I am trying to write a macro to display a message if a certain cell does

not
contain certain data. (I am working in Visual Basic)

i.e
If cell F1 = 100 then end
If cell F1 is not 100 then display a message "please re-enter data"

Can anyone please help




Nick

I do need a macro due to the code being written in an existing macro. I have
a sheet with 3 drop down menus. I have got everything to work when a print
preview button is pressed. I now want to idiot prove the program so that if
the numbers in a cell are changed the print preview macro will reconginse
this and display a message. How can i do this?

"Anne Troy" wrote:

You don't need a macro for that, Nick. Try this:
http://www.officearticles.com/excel/...soft_excel.htm
*******************
~Anne Troy

www.OfficeArticles.com
www.MyExpertsOnline.com


Nick Wright" wrote in message
...
I am trying to write a macro to display a message if a certain cell does

not
contain certain data. (I am working in Visual Basic)

i.e
If cell F1 = 100 then end
If cell F1 is not 100 then display a message "please re-enter data"

Can anyone please help





tina

Hi Nick
try using something like
If Range("f1") = 100 Then
Else
MsgBox ("please reenter data")
Exit Sub
End If

"Nick" wrote:

I do need a macro due to the code being written in an existing macro. I have
a sheet with 3 drop down menus. I have got everything to work when a print
preview button is pressed. I now want to idiot prove the program so that if
the numbers in a cell are changed the print preview macro will reconginse
this and display a message. How can i do this?

"Anne Troy" wrote:

You don't need a macro for that, Nick. Try this:
http://www.officearticles.com/excel/...soft_excel.htm
*******************
~Anne Troy

www.OfficeArticles.com
www.MyExpertsOnline.com


Nick Wright" wrote in message
...
I am trying to write a macro to display a message if a certain cell does

not
contain certain data. (I am working in Visual Basic)

i.e
If cell F1 = 100 then end
If cell F1 is not 100 then display a message "please re-enter data"

Can anyone please help






All times are GMT +1. The time now is 06:58 PM.

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