multiple iterations for a pair of goalseeks

pingpong777

New Member
Joined
Apr 6, 2015
Messages
42
Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+g
'
Range("g68").GoalSeek Goal:=Range("g61"), ChangingCell:=Range("g63")
End Sub

Sub Macro2()
'
' Macro2 Macro
'
' Keyboard Shortcut: Ctrl+g
'
Range("g78").GoalSeek Goal:=Range("g71"), ChangingCell:=Range("g73")
End Sub

hi. i have the 2 above goalseeks, and i need to run the pair of them multiple times. i'm sure this is a very simple addition, but how do i input the number of repetitions/iterations for this pair of goalseeks? i would like to link it to a cell in the worksheet, say cell g60 (if cell g60=10, run the pair of goalseeks 10 times).


thanks,

pingpong777
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I'm not sure why you would want t run the same Goal Seek multiple times, but give this a try:

Code:
Sub RunThem()
    Dim i As Long
    For i = 1 To Range("G60").Value
        Call Macro1
        Call Macro2
    Next i
End Sub
 
Upvote 0
hi, thank you. the 2 macros are different. I don't have everything laid out yet, so i don't know what the actual cell references will be, so i just picked some random numbers for the rows and made the 2 macros 10 rows apart.

the reason i have the pair and want to repeat 10 cycles is when i run macro, the change cell impacts the target cell for macro 1. so runnig macro 2 will knock macro 1 out of balance, so i want to go through some iterations to find a solution fo macro 2's change cell that also accomodates macro 1.

thanks again for your help!
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top