Hi, Not sure I can get your macro working as I'm not sure exactly what it does BUT as far as converting the fixed references to columns to variable references maybe try this. I set variables for the MOH value in the same month, the MOH column in the prior month and this column value for the chosen month. I assumed column "i" stays fixed and the others move relative to the chosen date. The dates were 2023 but your field in D1 was 2022 so I changed that and it at least seems to make amendments to the correct columns.
Sub GoalSeekMultipleCells()
Dim StartDate As Date
Dim Findcell, f As Range
Dim newpo, moh, mohcol As String
Dim ReqSheet As Worksheet
Set ReqSheet = Worksheets("REQ SHEET")
StartDate = ReqSheet.Range("D1").Value
Set Findcell = ReqSheet.Range("A3:AH3").Find(what:=StartDate, LookIn:=xlValues)
thiscol = Mid(Findcell.Address, 2, Len(Findcell.Address) - InStr(2, Findcell.Address, "$"))
newpo = Mid(Findcell.Offset(0, -3).Address, 2, Len(Findcell.Offset(0, -3).Address) - InStr(2, Findcell.Offset(0, -3).Address, "$"))
moh = Findcell.Offset(-1, 1).Value
mohcol = Mid(Findcell.Offset(0, 1).Address, 2, Len(Findcell.Offset(0, 1).Address) - InStr(2, Findcell.Offset(0, 1).Address, "$"))
For p = 4 To 30
Cells(p, newpo).ClearContents
If Cells(p, mohcol) < moh Then
On Error Resume Next
Cells(p, newpo).Value = Cells(p, "i").Value * moh - Cells(p, thiscol).Value
Cells(p, newpo).Value = Round(Cells(p, newpo).Value, 0)
End If
Next p
End Sub
Bookmarks