PDA

View Full Version : Popup to display warning message



elsuji
09-14-2019, 01:43 AM
Hi,

I am having data range of A5 : B104. The % variation between these two column A & B (for example A5 & B5 till A104 & B104) is updating on C5 to C104. While i am entering the data in "B5 to B104" if the value is crossing ±0.25 the popup message to be display ("Aggregate value is crossed the tolerance limit")

And other range is A109 : B133. On this range if the value is crossing ±0.25 the popup message to be display ("Cement value is crossed the tolerance limit")

But this popup to be display when the value is updating the specified range.

can any one please help me for this.

The sample file is updating here.

paulked
09-14-2019, 04:41 AM
Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Intersect(Target, Range("A5:C104")) Is Nothing) And Cells(Target.Row, 4) > 0.25 Then
MsgBox "Aggregate value has crossed the tolerance limit"
End If
End Sub

elsuji
09-15-2019, 06:57 AM
Dear Paulked

Thaks for your reply. It is working grate.

I have one more doubt. Is it possible to check the last updated row between the range of A5 : B104 and display the same message only for the last updated row.

For example i am entering the data from A5 to A50 only. And the message should be display for A50 only
And another time i entered from A5 to A75. then the message should be display for A75 only.

Can you please help me for this

Paul_Hossler
09-15-2019, 07:33 AM
Maybe




Option Explicit


Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range, r1 As Range

Set r = Target.Cells(1, 1)

If Intersect(r, Range("A5:B104")) Is Nothing Then Exit Sub
If Len(r.Value) = 0 Then Exit Sub

If Len(r.Offset(1, 0).Value) = 0 Then
Set r = Cells(Rows.Count, r.Column).End(xlUp)
Else
Set r = r.End(xlDown)
End If

If Abs(r.Value) > 0.25 Then MsgBox "Aggregate value has crossed the tolerance limit (" & r.Address & ")"
End Sub

elsuji
09-15-2019, 12:46 PM
It is not working. The message is displaying for all the cells. The message is to be shown only if last cell is more than .25

Paul_Hossler
09-15-2019, 01:40 PM
If you change any of the BLUE cells, the last cell (GREEN) is always < .25, so no message


25073


If you add a value at the bottom of the range > .25 (RED) the message shows

25075


If the last cell is > .25 the message always shows, even if the changed cell (ORANGE) is < .25

25076


What exactly are you asking for?

elsuji
09-15-2019, 09:53 PM
Yes. I want the same. But in message the cell value to be update instead of cell range

Paul_Hossler
09-16-2019, 06:52 AM
Ahhh -- when you said 'last cell' I thought that you meant 'last cell'



Option Explicit


Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range

Set r = Target.Cells(1, 1)

If Intersect(r, Range("A5:B104")) Is Nothing Then Exit Sub

If Abs(r.Value) > 0.25 Then MsgBox "Aggregate value has crossed the tolerance limit (" & r.Address & ")"
End Sub