I am trying to apply a formula where I need to refer to a few cells to the left of the formula cell and a few cells to the up and apply the formula down the column for quite a few rows.
I am trying to achieve the result by using offset function, but I am not getting the desired result.
I would be really grateful of any guidance.
Sub ResultAchievedIsNotAsRequired()
Dim variableA As Long
variableA = Worksheets("DATA").Range("D7").Value
Dim LeftRow As Long
LeftRow = ActiveCell.Offset(0, -1).Value
Dim Upperrow As Long
Upperrow = ActiveCell.Offset(-1, 0).Value
Dim q As Long
Worksheet("MyCalculation").Range("B2").Select
For q = 5 To 10
Selection.Value = (ActiveCell.Offset(0, -1).Value * (2 / (VariableA + 1)) + ActiveCell.Offset(-1, 0).Value * (1 - (2 / (VariableA + 1))))
ActiveCell.Offset(1, 0).Activate
Next
End Sub