Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Restrict Data Entry, data validation

I have a cell that is populated through a formula, I was hoping to have an
error to display if the formula brings that cell below zero. I would also
like to cancel the event that lead up to this error.

Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Restrict Data Entry, data validation

Paste following code in worksheet's code
(right-click on sheet tab, select Code)

'--------------------------
Private Sub Worksheet_Calculate()
If Range("A1").Value < 0 Then
MsgBox ("Below zero")
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End Sub
'------------------------------------

HTH
--
AP


"Dan Connors" a écrit dans le message
de ...
I have a cell that is populated through a formula, I was hoping to have an
error to display if the formula brings that cell below zero. I would also
like to cancel the event that lead up to this error.

Any ideas?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Restrict Data Entry, data validation

Fantastic! Thank you so much.

"Ardus Petus" wrote:

Paste following code in worksheet's code
(right-click on sheet tab, select Code)

'--------------------------
Private Sub Worksheet_Calculate()
If Range("A1").Value < 0 Then
MsgBox ("Below zero")
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End Sub
'------------------------------------

HTH
--
AP


"Dan Connors" a écrit dans le message
de ...
I have a cell that is populated through a formula, I was hoping to have an
error to display if the formula brings that cell below zero. I would also
like to cancel the event that lead up to this error.

Any ideas?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Restrict Data Entry, data validation

Thanks for the feedback!
--
AP

"Dan Connors" a écrit dans le message
de ...
Fantastic! Thank you so much.

"Ardus Petus" wrote:

Paste following code in worksheet's code
(right-click on sheet tab, select Code)

'--------------------------
Private Sub Worksheet_Calculate()
If Range("A1").Value < 0 Then
MsgBox ("Below zero")
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End Sub
'------------------------------------

HTH
--
AP


"Dan Connors" a écrit dans le

message
de ...
I have a cell that is populated through a formula, I was hoping to

have an
error to display if the formula brings that cell below zero. I would

also
like to cancel the event that lead up to this error.

Any ideas?






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
Data Validation - Restrict entry but without dropdown Leanne M (Aussie) Excel Discussion (Misc queries) 2 April 18th 09 05:40 PM
How do I restrict data entry to one of two columns but not both? Gillian Excel Discussion (Misc queries) 4 July 16th 08 06:06 PM
How do I restrict data entry to one of two columns Gillian Excel Discussion (Misc queries) 2 July 16th 08 02:07 PM
Restrict Data Entry to only 4 possible entries ph8[_45_] Excel Programming 2 March 21st 06 03:25 PM
Restrict Data Entry to only 4 possible entries ph8[_46_] Excel Programming 1 March 21st 06 03:19 PM


All times are GMT +1. The time now is 03:01 PM.

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

About Us

"It's about Microsoft Excel"