Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2008

Tip: Looking for answers? Try searching our database.

Error Message Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alish - 20 Apr 2008 19:02 GMT
All,
How to me excel to give an error message on a conditional format?Like for
example if a cell is greater than 365 besides giving a red background as it
is conditional formatted, it also should shoot an error message in the screen
saying for instance "over 365 dyas" or something. Your help is appreciated.
Thanks.
Gord Dibben - 20 Apr 2008 20:32 GMT
CF cannot give you messages, only change formatting.

To have the message shown you would need a formula in an adjacent cell.

Assume A1 is to be red...........in B1 enter

=IF(A1>365,"A1 has exceeded 365 days")

Alternative would be to use VBA event code to pop up a message box and color at
the same time.

Private Sub Worksheet_Calculate()
On Error GoTo stoppit
  Application.EnableEvents = False
  With Me.Range("A1")
  If .Value > 365 Then
.Interior.ColorIndex = 3
MsgBox "Please be advised that A1 has exceeded 365 days"
End If
End With
stoppit:
Application.EnableEvents = True
End Sub

This is sheet event code.  Right-click on the sheet tab and "View Code".
Copy/paste the above into that sheet module.

Edit the range "A1" to suit.

Alt + q to return to the Excel window

Gord Dibben  MS Excel MVP

>All,
>How to me excel to give an error message on a conditional format?Like for
>example if a cell is greater than 365 besides giving a red background as it
>is conditional formatted, it also should shoot an error message in the screen
>saying for instance "over 365 dyas" or something. Your help is appreciated.
>Thanks.
alish - 21 Apr 2008 07:46 GMT
Gord, Thanks, it worked!

> CF cannot give you messages, only change formatting.
>
[quoted text clipped - 35 lines]
> >saying for instance "over 365 dyas" or something. Your help is appreciated.
> >Thanks.
Gord Dibben - 21 Apr 2008 20:57 GMT
Thanks for the feedback.

Which one did you go with?

Gord

>Gord, Thanks, it worked!
>
[quoted text clipped - 37 lines]
>> >saying for instance "over 365 dyas" or something. Your help is appreciated.
>> >Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.