ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Prompt when Cell Changes to 0 (https://www.excelbanter.com/excel-discussion-misc-queries/67253-prompt-when-cell-changes-0-a.html)

Dolphinv4

Prompt when Cell Changes to 0
 
Hi,

I have 3 sheets whereby sheet 1 is linked to sheets 2 & 3. If I type some
things in sheets 2 & 3, cell C36 in sheet 1 may or may not change. If it
changes to more than 0, I want a message box to prompt me.

I setup the vba code as below BUT it only works if the changes are done in
sheet 1, ie, if i change some things in sheets 2 & 3 and C35 in sheet 1
changes, there is no prompt but if I change some things in sheet 1 such that
C36 changes, THEN i get the prompt. How can I change the code to do what I
want in paragraph 1 above?

Thanks!

Private Sub Worksheet_Change(ByVal Target As Range)


Dim Change As Variant

Change = Range("C36").Value
If Change 0 Then
MsgBox "Error"
End If


End Sub

Dave Peterson

Prompt when Cell Changes to 0
 
Maybe using worksheet_calculate would be better than _change.



Dolphinv4 wrote:

Hi,

I have 3 sheets whereby sheet 1 is linked to sheets 2 & 3. If I type some
things in sheets 2 & 3, cell C36 in sheet 1 may or may not change. If it
changes to more than 0, I want a message box to prompt me.

I setup the vba code as below BUT it only works if the changes are done in
sheet 1, ie, if i change some things in sheets 2 & 3 and C35 in sheet 1
changes, there is no prompt but if I change some things in sheet 1 such that
C36 changes, THEN i get the prompt. How can I change the code to do what I
want in paragraph 1 above?

Thanks!

Private Sub Worksheet_Change(ByVal Target As Range)

Dim Change As Variant

Change = Range("C36").Value
If Change 0 Then
MsgBox "Error"
End If


End Sub


--

Dave Peterson


All times are GMT +1. The time now is 05:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com