Hi
I have found this code which calculates a cell value but the code is restricted to Range("B1:B3"), my problem is that the column range can change depending on data exported to excel, can anyone advise on how to overcome this!
Dim rng As Range
Dim Lraw As Long
'Calculate moving average
Set rng = Range("B1:B3")
For Lraw = 3 To 12
Cells(Lraw, "c").Value = WorksheetFunction.Sum(rng) / 3
Set rng = rng.Offset(1, 0)
Next Lraw
I have found this code which calculates a cell value but the code is restricted to Range("B1:B3"), my problem is that the column range can change depending on data exported to excel, can anyone advise on how to overcome this!
Dim rng As Range
Dim Lraw As Long
'Calculate moving average
Set rng = Range("B1:B3")
For Lraw = 3 To 12
Cells(Lraw, "c").Value = WorksheetFunction.Sum(rng) / 3
Set rng = rng.Offset(1, 0)
Next Lraw