![]() |
How retain calculated value in a cell despite changes to inputs
Please, could any one help me to save the result resent in a cell following a
calculation (by functions), despite changing the parameters affecting the results? For example; If I do a*b=c I want the result c to be saved in a cell while I change b to d in the same function. If now a*d=e I would like a row, somewhat like the below c e .. .. .. Hope this is clear. Thank you |
How retain calculated value in a cell despite changes to inputs
Let's say in C1 we have
=A1+B1 and we want to record the values in C1 in the cells below whenever we change either A1 or B1. Enter the following macro in the worksheet code area: Private Sub Worksheet_Change(ByVal Target As Range) Set r = Range("A1:B1") If Intersect(r, Target) Is Nothing Then Exit Sub n = Cells(Rows.Count, "C").End(xlUp).Row + 1 Cells(n, "C").Value = Range("C1").Value End Sub The first time either A1 or B1 is changed the value in C1 is copied to C2, the next time to C3, etc. REMEMBER the worksheet code area, not a standard module. -- Gary''s Student - gsnu200750 "pnic" wrote: Please, could any one help me to save the result resent in a cell following a calculation (by functions), despite changing the parameters affecting the results? For example; If I do a*b=c I want the result c to be saved in a cell while I change b to d in the same function. If now a*d=e I would like a row, somewhat like the below c e . . . Hope this is clear. Thank you |
All times are GMT +1. The time now is 02:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com