ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Goal Seek in a loop (https://www.excelbanter.com/excel-discussion-misc-queries/36618-goal-seek-loop.html)

Brother

Goal Seek in a loop
 

I have used the following to run a simple goalseek on one line.

Range("AE3").Select
Range("AE3").GoalSeek Goal:=0, ChangingCell:=Range("AA3")

Is it possible to get this doen in a loop acting on every entry in column AE?

Bill Martin -- (Remove NOSPAM from address)

Brother wrote:
I have used the following to run a simple goalseek on one line.

Range("AE3").Select
Range("AE3").GoalSeek Goal:=0, ChangingCell:=Range("AA3")

Is it possible to get this doen in a loop acting on every entry in column AE?



How about something of the form:

x=3
y$ = "AE" + FORMAT(x,"#")
while range(y$) 0
Do your stuff here
x = x+1
wend

Bill

Bill Martin -- (Remove NOSPAM from address)

Brother wrote:
I have used the following to run a simple goalseek on one line.

Range("AE3").Select
Range("AE3").GoalSeek Goal:=0, ChangingCell:=Range("AA3")

Is it possible to get this doen in a loop acting on every entry in column AE?



How about something of the form:

x=3
y$ = "AE" + FORMAT(x,"#")
while range(y$) 0
Do your stuff here
x = x+1
y$ = "AE" + FORMAT(x,"#")
wend

Bill

Dave

Goal Seek in a loop
 
Bill,

How would you change the macro if the data is in rows instead of columns?

Dave

"Bill Martin -- (Remove NOSPAM from addre" wrote:

Brother wrote:
I have used the following to run a simple goalseek on one line.

Range("AE3").Select
Range("AE3").GoalSeek Goal:=0, ChangingCell:=Range("AA3")

Is it possible to get this doen in a loop acting on every entry in column AE?



How about something of the form:

x=3
y$ = "AE" + FORMAT(x,"#")
while range(y$) 0
Do your stuff here
x = x+1
y$ = "AE" + FORMAT(x,"#")
wend

Bill



All times are GMT +1. The time now is 12:36 PM.

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