How to find max and min of a dyanamic cell in Excel Hi all, with regard to the above vba code, I tried the code but the max/min cell only updates if I click on the dynamic cell and then click away. If the workbook is not active and is in the background while I work on other programs,the min/max cells wouldn't update. How do I fix this? Thank you in advance.
This can be achieved with a regular formula, but requires Iterative Calculation to be enabled.
This is set under Options/Formulas
With this set, The Max
formula should reference the cell(s) you want to monitor, and itself.
Eg if your Max
is in D3
in Sheet1
and is monitoring B3
on Sheet2
then use
=MAX(Sheet2!B3,D3)
Note: stored Max value will survive the workbook being closed and reopened.
Thic can be achieved with a volitile UDF
, using a Static
variable to remember the last Max value
Function MyMax(r As Range) As Variant
Application.Volatile True
Static LastMax As Variant
Dim NewMax As Variant
NewMax = Application.WorksheetFunction.Max(r)
If NewMax > LastMax Then
LastMax = NewMax
End If
MyMax = LastMax
End Function
Note:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.