Automate GoalSeek

G

Gunnar Lysaker

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
 
M

Michael

Set introw2 = 137 should placed before Set mycell = Range("R" & "introw2")
otherwise you will get R and Empty
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top