Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple request
How do you get a message box to appear when a cell is 0.
I have a simple function that has values and I want a message box (with a warning)to appear when the cell is equal to zero. Exel VB newbie |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple request
'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range) '----------------------------------------------------------------- Const WS_RANGE As String = "H10" On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then If Target.Value = 0 MsgBox "tell me something" End If End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Johnmayo" wrote in message ... How do you get a message box to appear when a cell is 0. I have a simple function that has values and I want a message box (with a warning)to appear when the cell is equal to zero. Exel VB newbie |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple request
"Johnmayo" wrote in message
... How do you get a message box to appear when a cell is 0. I have a simple function that has values and I want a message box (with a warning)to appear when the cell is equal to zero. In addition to Bob's VBA solution, you can do this with Excel's Data Validation featu 1) Choose Data Validation from the Excel menu. 2) In the Settings tab select "Custom" from the Allow dropdown. 3) Enter the following formula in the Formula box, substituting the address of your cell for $A$1: =$A$1<0 4) Select the Error Alert tab 5) Select "Information" from the Style dropdown, then enter a message box title and a message in the two other controls. -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Request for VB to do something simple (insert text in a column ofcells) | Excel Discussion (Misc queries) | |||
Here is a simple formula request from a newb | Excel Worksheet Functions | |||
Simple line fix request. | Excel Programming | |||
DATEDIF Simple request | Excel Worksheet Functions | |||
CF in VB Code - Simple Request | Excel Programming |