# Need urgent help in excel please

#### Peter_SSs

##### MrExcel MVP, Moderator
Please do it fast if you can!
Further to Yongle's comments about that, please refer to the last sentence in #5 of the Forum Rules
and point 5 of the Guidelines, particularly 5g and 5h.

### Excel Facts

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

#### danish6061

##### New Member
Sorry Yongle if you bother!

#### danish6061

##### New Member
Actually my client want it fast

Sir, is it done?

#### Yongle

##### Well-known Member
I was in the middle of writing a reply when you post arrived
I have stopped writing my reply

You have annoyed me

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

#### Yongle

##### Well-known Member
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
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
Its not working because I am anable to implied sheet code. Where it will implie?

#### danish6061

##### New Member
Sorry Yongle, but it's not working!