PC Review


Reply
Thread Tools Rate Thread

How to create msg box if a cell contains value < 0

 
 
ghost
Guest
Posts: n/a
 
      17th Jan 2008
Greeting,
I have a column has 5 cells which they have function (sum) depend on other
cells. In those cells I what to make a msgbox warns the user that the value
of one of them or all is under 0 and the user should input other data . i.e.
if E1 has the value of sum A1and B1, a msg box appears and warns.
how can I do that?
 
Reply With Quote
 
 
 
 
Per Jessen
Guest
Posts: n/a
 
      17th Jan 2008
On 17 Jan., 20:52, ghost <gh...@discussions.microsoft.com> wrote:
> Greeting,
> I have a column has 5 cells which they have function (sum) depend on other
> cells. In those cells I what to make a msgbox warns the user that the value
> of one of them or all is under 0 and the user should input other data . i.e.
> if E1 has the value of sum A1and B1, a msg box appears and warns.
> how can I do that?


Hi

Insert the code in the code-sheet for the desired sheet.

Private Sub Worksheet_Calculate()
If Range("E1") < 0 Then
MsgBox ("Error")
End If
End Sub

//Per
 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      17th Jan 2008
The problem I see with a message box solution is as soon as the message box
was dismissed, it would pop up again giving the user no time to act. How
about this instead. Select the five cells; click
Format/ConditionalFormatting from Excel's menu; select "Cell Value Is" from
the first field, "less than" from the second field, put 0 into the third
field; click the Format button; click the Font tab and select Bold from the
"Font style" field and White from the Color drop down; click the Patterns
tab and pick a dark red color from the Color grid; then OK your way back to
the spread sheet. Now, if any of these cells fall below zero, they will be
highlighted in the color with the font style you just picked.

Rick


"ghost" <(E-Mail Removed)> wrote in message
news:715EF120-982F-4D8F-9F7B-(E-Mail Removed)...
> Greeting,
> I have a column has 5 cells which they have function (sum) depend on other
> cells. In those cells I what to make a msgbox warns the user that the
> value
> of one of them or all is under 0 and the user should input other data .
> i.e.
> if E1 has the value of sum A1and B1, a msg box appears and warns.
> how can I do that?


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a cell reference to create linked info in another cell LCrowe Microsoft Excel Misc 2 28th Feb 2008 05:26 PM
Create Cell Comment based on text in a cell on another worksheet =?Utf-8?B?RGF2ZSBGZWxsbWFu?= Microsoft Excel Misc 2 15th Mar 2007 09:49 AM
How to create/run "cell A equals Cell B put Cell C info in Cell D =?Utf-8?B?YWJtYjE2MQ==?= Microsoft Excel Misc 5 26th Jan 2006 06:36 PM
create formula to compare cell 1 with a range of cell =?Utf-8?B?S0tYQw==?= Microsoft Excel Programming 2 7th Jan 2006 06:37 AM
Excel - create button to replace cell content with cell value =?Utf-8?B?YmxhY2ttb3Q=?= Microsoft Excel Worksheet Functions 3 7th Dec 2005 05:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:34 AM.