What i am trying to do on VBA is to select only the four most recent data entry's and add them together and place the result to the right of the fourth data entry, when the next four data entry's are input i want the formula to only add these entry's and input that result to the right of the last entry. can someone be able to tell me where I'm going wrong please!
Private Sub CommandButton3_Click()
Dim wks As Worksheet
Dim addnew As Range
Set wks = Sheet2
Dim x
x = wks.Range("G2").End(xlDown).Value + wks.Range("G2").End(xlDown).Offset(-1, 0).Value + wks.Range("G2").End(xlDown).Offset(-2, 0).Value + wks.Range("G2").End(xlDown).Offset(-3, 0).Value
Set addnew = wks.Range("H65356").End(xlUp).Offset(1, 0)
addnew.Offset(3, 0).Value = x