PC Review


Reply
Thread Tools Rate Thread

Cell warns of excessive value

 
 
Ascesis
Guest
Posts: n/a
 
      26th Jul 2006

OK, my next problem.

I have a cell which calculates the total cost of 'costs' - obviously.

Now, I would like to know how to integrate a warning thing that wil
let the user know when the cost has exceeded a certain value.

For example, if the total cost currently stands at £1000 and then I ad
£2000 to 'cost' so that the total cost is now £3000, I should get
warning saying that this is too much, because the 'budget' is £2000

I've tried various things with the Data > Validation tool, but with n
success. If anyone can help me, it will be greatly appreciated

--
Ascesi
-----------------------------------------------------------------------
Ascesis's Profile: http://www.excelforum.com/member.php...fo&userid=3680
View this thread: http://www.excelforum.com/showthread.php?threadid=56522

 
Reply With Quote
 
 
 
 
Bernie Deitrick
Guest
Posts: n/a
 
      26th Jul 2006
Ascesis,

Use Conditional Formatting instead. You can set the value at which it changes color to a set value,
or to another cell's value.

Use Format / Conditional Format... select "Cell Value" " is greater than" and enter 2000 or a
cell reference, then set the format to shade the cell red when the value is exceeded.

HTH,
Bernie
MS Excel MVP


"Ascesis" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> OK, my next problem.
>
> I have a cell which calculates the total cost of 'costs' - obviously.
>
> Now, I would like to know how to integrate a warning thing that will
> let the user know when the cost has exceeded a certain value.
>
> For example, if the total cost currently stands at £1000 and then I add
> £2000 to 'cost' so that the total cost is now £3000, I should get a
> warning saying that this is too much, because the 'budget' is £2000
>
> I've tried various things with the Data > Validation tool, but with no
> success. If anyone can help me, it will be greatly appreciated.
>
>
> --
> Ascesis
> ------------------------------------------------------------------------
> Ascesis's Profile: http://www.excelforum.com/member.php...o&userid=36801
> View this thread: http://www.excelforum.com/showthread...hreadid=565221
>



 
Reply With Quote
 
Excelenator
Guest
Posts: n/a
 
      26th Jul 2006

You could place the following in the worksheet calculation event in the
VB editor


Code:
--------------------
Private Sub Worksheet_Calculate()
If Range("Costs").Value > 2000 Then
MsgBox "The budget is only 2000"
End If
End Sub
--------------------


This would give you the message box above if the total surpasses the
limit you set.


--
Excelenator


------------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768
View this thread: http://www.excelforum.com/showthread...hreadid=565221

 
Reply With Quote
 
Ascesis
Guest
Posts: n/a
 
      27th Jul 2006

I had more success with the Conditional Formatting. Thanks a lot.


--
Ascesis
------------------------------------------------------------------------
Ascesis's Profile: http://www.excelforum.com/member.php...o&userid=36801
View this thread: http://www.excelforum.com/showthread...hreadid=565221

 
Reply With Quote
 
Ascesis
Guest
Posts: n/a
 
      27th Jul 2006

> Private Sub Worksheet_Calculate()
> If Range("Costs").Value > 2000 Then
> MsgBox "The budget is only 2000"
> End If
> End Sub


Is there something in this that I will have to change so that it work
on my worksheet?

I get a debug error when I paste this code in, and the code edito
highlights "If Range("Costs").Value > 2000 Then" in yellow. Hoverin
the cursor over this reveals something like, 'Method range o
object_worksheet failed'

--
Ascesi
-----------------------------------------------------------------------
Ascesis's Profile: http://www.excelforum.com/member.php...fo&userid=3680
View this thread: http://www.excelforum.com/showthread.php?threadid=56522

 
Reply With Quote
 
Bernie Deitrick
Guest
Posts: n/a
 
      27th Jul 2006
You have to name a cell Costs .

But note that this code will flash a message everytime you calculate, if the value is over 2000.
Better to limit the effect by using the Change event, and checking to see if the cells being summed
have been changed prior to giving the message.

HTH,
Bernie
MS Excel MVP


"Ascesis" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
>> Private Sub Worksheet_Calculate()
>> If Range("Costs").Value > 2000 Then
>> MsgBox "The budget is only 2000"
>> End If
>> End Sub

>
> Is there something in this that I will have to change so that it works
> on my worksheet?
>
> I get a debug error when I paste this code in, and the code editor
> highlights "If Range("Costs").Value > 2000 Then" in yellow. Hovering
> the cursor over this reveals something like, 'Method range of
> object_worksheet failed'.
>
>
> --
> Ascesis
> ------------------------------------------------------------------------
> Ascesis's Profile: http://www.excelforum.com/member.php...o&userid=36801
> View this thread: http://www.excelforum.com/showthread...hreadid=565221
>



 
Reply With Quote
 
Ascesis
Guest
Posts: n/a
 
      28th Jul 2006

yeah, this isn't going too well.

I think a message box is a superfluity for my work, anyway.

Just interested.


I'll take out one of those thick Excel guides from the library soon
:cool

--
Ascesi
-----------------------------------------------------------------------
Ascesis's Profile: http://www.excelforum.com/member.php...fo&userid=3680
View this thread: http://www.excelforum.com/showthread.php?threadid=56522

 
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
Re: VB to merge cells but that warns when only one cell is selected? Gord Dibben Microsoft Excel Programming 1 24th May 2011 04:45 AM
Re: VB to merge cells but that warns when only one cell is selected? Clif McIrvin Microsoft Excel Programming 1 13th May 2011 07:15 PM
Re: Expert Warns of Economic 9/11 for U.S. Dr. Jai Maharaj Freeware 0 2nd Jul 2006 04:53 AM
Re: Expert Warns of Economic 9/11 for U.S. Joe935 Freeware 0 23rd Jun 2006 11:31 AM
My comp warns me and then shuts down please help! Roger Seitzinger Windows XP General 4 28th Sep 2003 05:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:00 AM.