ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Goalseek - loop range (https://www.excelbanter.com/excel-programming/394247-goalseek-loop-range.html)

al

Goalseek - loop range
 
Could someone pls correct/improve my macro - thxs



Sub Goal_SeekRANGt()


TargetVal = Range("Setcell").Offset(0, 1).Resize(1, 12).Address

DesiredVal = Range("Changedto").Offset(0, 1).Resize(1, 12).Address

ChangeVal = Range("ByChanging").Offset(0, 1).Resize(1, 12).Address

' Loop through the goalseek method
For i = 1 To TargetVal.Columns.Count
TargetVal.Cells(i).GOALSEEK Goal:=DesiredVal.Cells(i).Value,
ChangingCell:=ChangeVal.Cells(i)
Next i
End Sub



All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com