Hi there,
I'm having issues with a running max code as I'm not familiar with VBA. Essentially I have a cell with a formula in which goes up and down as I add values elsewhere. I need the VBA code to record and maintain the absolute max value this cell reaches (and not dip below 0).
So far I have go this to kind of work but only when the target cells value is input manually as a number. I need it to use the output of the formula of the target cell. Pretty sure this is a simple thing i'm missing but everything i try (such as inlaying the cells formula into the VBA code) doesn't work.
The formula in C27 is: =(SUM(D30:D1011))+(SUM(C30:C1011))
I also need this to work in the same way across the sheet so also in G27, K27 etc. My half working code did this but i just added in more chunks of the above. As long as this doesn't cause it to slow massively I ok with that,
Any help much appreciated.
Thanks
I'm having issues with a running max code as I'm not familiar with VBA. Essentially I have a cell with a formula in which goes up and down as I add values elsewhere. I need the VBA code to record and maintain the absolute max value this cell reaches (and not dip below 0).
So far I have go this to kind of work but only when the target cells value is input manually as a number. I need it to use the output of the formula of the target cell. Pretty sure this is a simple thing i'm missing but everything i try (such as inlaying the cells formula into the VBA code) doesn't work.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$27" And IsNumeric(Output) Then
If Target.Value > Target.Offset(-4, 1) Then
Target.Offset(-4, 1) = Target.Value
End If
End If
End Sub
The formula in C27 is: =(SUM(D30:D1011))+(SUM(C30:C1011))
I also need this to work in the same way across the sheet so also in G27, K27 etc. My half working code did this but i just added in more chunks of the above. As long as this doesn't cause it to slow massively I ok with that,
Any help much appreciated.
Thanks