Need urgent help in excel please

Some videos you may like

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

danish6061

New Member
Joined
Mar 16, 2020
Messages
29
Office Version
2016
Platform
Windows
Actually my client want it fast
But, you take your time
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
5,249
Office Version
365
Platform
Windows
I was in the middle of writing a reply when you post arrived
I have stopped writing my reply
Did you read what @Peter_SSs asked you to read ?

You have annoyed me :mad::mad:

You will receive my solution in 3 hours if I am not still annoyed
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
5,249
Office Version
365
Platform
Windows
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
 

danish6061

New Member
Joined
Mar 16, 2020
Messages
29
Office Version
2016
Platform
Windows
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?
 

danish6061

New Member
Joined
Mar 16, 2020
Messages
29
Office Version
2016
Platform
Windows
Its not working because I am anable to implied sheet code. Where it will implie?
 

Forum statistics

Threads
1,089,217
Messages
5,406,916
Members
403,111
Latest member
Donbozone

This Week's Hot Topics

Top