Newbie. Please help me find a loop solution
I am trying to calculate a value for a cell and at the same time store
the previous cell value for the next calculation. The following code works, but I need to find a way to loop this until column AN and row 3000. I know there must be a better solution than how my code works and would be very greatful if someone can point me in the right direction. Sub test() Dim temp As Single Dim temp2 As Single temp = Range("m2").Value Range("m2").Value = Range("j2").Value - temp temp2 = Range("n2").Value Range("n2").Value = temp - temp2 temp = Range("o2").Value Range("o2").Value = temp2 - temp temp2 = Range("p2").Value Range("p2").Value = temp2 - temp End Sub I know there must be a better solution than how my code works and would be very greatful if someone can point me in the right direction. Nigel Brown |
All times are GMT +1. The time now is 08:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com