ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automate GoalSeek (https://www.excelbanter.com/excel-programming/421449-automate-goalseek.html)

Gunnar Lysaker

Automate GoalSeek
 
Hi,

When I start this For
"For introw = 137 To 139" it is something wrong. Anyhelp out there?

---

Sub Macro3()
Dim introw As Integer
Dim introw2 As Integer
Dim ShtSpread As Worksheet
Set ShtSpread = Sheets("2009Analyse")
ShtSpread.Activate
Dim Gunnar As Long

Set introw = 137

Set mycell = Range("R" & "introw2")
Set introw2 = 137
For introw = 137 To 139
Range("R" & "introw2).GoalSeek Goal:=0.063,
ChangingCell:=Range("M"&introw)

introw2 = introw2 + 1
introw = introw + 1

Next introw


End Sub

Michael

Automate GoalSeek
 
Set introw2 = 137 should placed before Set mycell = Range("R" & "introw2")
otherwise you will get R and Empty
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Gunnar Lysaker" wrote:

Hi,

When I start this For
"For introw = 137 To 139" it is something wrong. Anyhelp out there?

---

Sub Macro3()
Dim introw As Integer
Dim introw2 As Integer
Dim ShtSpread As Worksheet
Set ShtSpread = Sheets("2009Analyse")
ShtSpread.Activate
Dim Gunnar As Long

Set introw = 137

Set mycell = Range("R" & "introw2")
Set introw2 = 137
For introw = 137 To 139
Range("R" & "introw2).GoalSeek Goal:=0.063,
ChangingCell:=Range("M"&introw)

introw2 = introw2 + 1
introw = introw + 1

Next introw


End Sub



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

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