Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ann Ann is offline
external usenet poster
 
Posts: 3
Default MsgBox Question - HELP!

I need to set up a warning message box that appears if a
value exceeds 80. I need the message to say something
like..."Warning, hours exceed limitation, Do you want to
continue?" If they do, then they will be allowed to enter
in the amount, if not, then they screen will just go back
to how it was before they entered to high number.
Can anyone help me on this? My code is not working.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default MsgBox Question - HELP!

Hi Ann
try the following code for cell A1

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Static Save_old_cell
Dim msg_return
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
If Target.Cells.Count 1 Then Exit Sub
On Error GoTo CleanUp
With Target
If .Value 80 Then
msgreturn = MsgBox("Value is too large - Continue?",
vbOKCancel)
If msgreturn = 2 Then
Application.EnableEvents = False
.Value = Save_old_cell
End If
End If

Save_old_cell = .Value
End With
CleanUp:
Application.EnableEvents = True
End Sub

HTH
Frank

Ann wrote:
I need to set up a warning message box that appears if a
value exceeds 80. I need the message to say something
like..."Warning, hours exceed limitation, Do you want to
continue?" If they do, then they will be allowed to enter
in the amount, if not, then they screen will just go back
to how it was before they entered to high number.
Can anyone help me on this? My code is not working.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
msgbox question Wu Excel Discussion (Misc queries) 2 November 9th 08 11:26 AM
MsgBox Question Ray Batig Excel Programming 1 December 23rd 03 03:42 AM
MsgBox question gareth Excel Programming 2 November 19th 03 05:30 PM
Msgbox question Pancho Excel Programming 4 October 23rd 03 05:36 PM
MsgBox Question Chip Pearson Excel Programming 1 September 29th 03 05:56 PM


All times are GMT +1. The time now is 06:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"