![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Posts: 86
|
Can I have a message box appear using a formula in a cell. For example: =if(a1=2,msgbox "nope",9). I know this example does not work.
Thanks in advance [ This Message was edited by: topswim on 2002-05-16 21:12 ] |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: North Alabama, USA
Posts: 105
|
If you are up for a little VBA something like =nope(a1) tied to
[code] Public Function nope(x) If x = 2 Then MsgBox ("Nope") nope = 2 Else nope = 9 End If End Function [code]
__________________
Hope this helps! Rocky <h6>"Be not the first by whom the New are try'd, Nor yet the last to lay the Old aside." Alexander Pope (1688-1744).</h6> |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Huntington Beach, CA USA
Posts: 327
|
Hi topswim,
Right click on the sheet tab that you want this to take affect in and type or copy and paste: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If [A1].Value = 2 Then MsgBox"nope 9", vbExclamation End If End Sub James |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
I believe you will find "data validation" will do what you want:
Data validation is located: --toolbar ---data ----validation... On the Setting tab: select the rule you want ie. Allow=custum , formula <>2 On the Error Alert tab Type your message i.e. NOPE click OK ... boomba done _________________ NOTE: Testing performed on Win2K utilizing Office 2000. Solutions may need tweaking for other versions. Adieu,Nimrod [ This Message was edited by: Nimrod on 2002-05-16 22:10 ] |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Location: Sydney/Brisbane , Australia
Posts: 539
|
Nimrod.
It is a point to note that this sort of data validation only works if you are tying straight into the cell with the validation. if the cell value is a result of a formula it will not perform the same action. |
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
Hi Q:
Yep but I'm thinking this may do topswim wants..... But this won't be the first time I mis-understood what someone wants... either way no harm done ...
__________________
<MARQUEE>...........Never be afraid to try something new. Remember, amateurs built the ark, professionals built the Titanic...............The easiest thing to find is fault, don't be easy !.. --Anonymous--...</marquee> |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Mar 2002
Location: Sydney/Brisbane , Australia
Posts: 539
|
I know what you mean... Please don't get offended if i sound out of line. Sometimes some answers just seem to obvious to be the right ones.
__________________
Colin |
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
no problem Q
|
|
|
|
|
|
#9 |
|
Board Regular
Join Date: May 2002
Posts: 86
|
Thanks for all the help.
Topswim |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|