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
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
The formula below recalculates whenever the value in cell A1 changes
Place formula in any cell in the sheet Book (1)
= SUM(A1)

When the above formula recalculates it triggers event macro worksheet_calculate

I do not know where you want the min and max values
- currently being placed in Z1 and Z2
- amend the code to reflect what you want

I assume that the workbook is opened at the start of each day and closed at the end of the day
The calculations reset every time the workbook is opened
- if that is not what you want, please let me know

In sheet code
VBA Code:
Private Sub Worksheet_Calculate()
    Call MacroX(Me)
End Sub

In a module like Module1
VBA Code:
Option Explicit
Public wf As WorksheetFunction
Public tMax As Double
Public tMin As Double
Public A1 As Variant

Sub MacroX(sh As Worksheet)
    Set wf = WorksheetFunction
    On Error Resume Next
    If tMin = 0 Then tMin = 99999999
    A1 = sh.Range("A1").Value
    tMax = wf.Max(tMax, A1)
    tMin = wf.Min(tMin, A1)
    sh.Range("Z1") = tMax
    sh.Range("Z2") = tMin
End Sub
 
Upvote 0
Thank you very much Yongle!
But I don't have much more knowledge about coding and VBA.
So, I wanted to where will be the sheet code implies?
 
Upvote 0
Its not working because I am anable to implied sheet code. Where it will implie?
 
Upvote 0
Sheet code.jpg



Sheet Book(1).jpg


Module1 code.jpg
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,520
Members
448,968
Latest member
Ajax40

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