Need urgent help in excel please

danish6061

New Member
Joined
Mar 16, 2020
Messages
44
Office Version
  1. 2016
Platform
  1. Windows
In a cell that is continuously changing every second, i need to monitor that cell and detect its highest & lowest values during a day, how can i achieve this, pls help
 
In simple words, I want a code which will work for cell a1 and a18 in same sheet and shows the result in Z2 and Z3 and A18 and A18...
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Which cell will contain this formula ?
=A18
 
Upvote 0
In simple words, I want a code which will work for cell a1 and a18 in same sheet and shows the result in Z2 and Z3 and A18 and A19...
(
above amended for this Sorry, shows the result in A18 and A19 )

This makes no sense :unsure:
- you cannot monitor the value in A18 AND use that cell for max\min value
 
Upvote 0
Sorry to unclarify you, I just want this same thing in cell A18, because data will cautiously change in A18 too.
 
Upvote 0
I am unable to help until you understand what I am telling you

You cannot use A18 for max and A19 for min if cell A18 is the cell being monitored
 
Upvote 0
Ohhhh.. my typing mistake,
I apologize you to bothering you.
Actually data will be monitored in A1 and A18 cells and result should be shown in Z1 and Z2 for A1 cell, and Z18 and Z19 for A 18 cell. *(In same sheet)
 
Upvote 0
I will post amended code when back at my PC tomorrow
 
Upvote 0
I used Z18 cell as trigger cell when value A18 changes
Enter this formula in Z18
=A18

I used Z19 and Z20 to hold MIN & MAX values for A18

VBA Code:
Private oldValueA1 As Variant, oldValueA18 As Variant

Private Sub Worksheet_Calculate()
    If CStr(oldValueA1) = "" Then
        Range("Z3") = 9999999
        Range("Z2") = 0
    End If
    If CStr(oldValueA18) = "" Then
        Range("Z20") = 9999999
        Range("Z19") = 0
    End If
    If Range("A1") = oldValueA1 And Range("A18") = oldValueA18 Then Exit Sub
    oldValueA1 = Range("A1").Value
    oldValueA18 = Range("A18").Value
    Call MacroY
End Sub

Sub MacroY()
'A1 values
    Range("Z2") = WorksheetFunction.Max(Range("A1"),Range("Z2"))
    If Range("Z3") = 0 Then Range("Z3") = 9999999
    Range("Z3") = WorksheetFunction.Min(Range("A1"), range("Z3"))
'A18 values
    Range("Z19") = WorksheetFunction.Max(Range("A18"),Range("Z19"))
    If Range("Z20") = 0 Then Range("Z20") = 9999999
    Range("Z20") = WorksheetFunction.Min(Range("A18"), range("Z20"))
End Sub

As you can see I have replicated everything for A1, Z1, Z2, Z3 and referred to A18, Z18, Z19, Z20
If you want to add any more monitored cells then amend the code yourself using the same technique
 
Upvote 0
But By this code the value of cell a1 and a18 will be the same but i will trigger different values in both cells thats why need different max. min, values for both cells.
 
Upvote 0

Forum statistics

Threads
1,214,635
Messages
6,120,660
Members
448,975
Latest member
sweeberry

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top