Created
May 30, 2019 09:07
-
-
Save excelcrafters/74b0ad8f0f8274f8e2bb7eba68f5ec79 to your computer and use it in GitHub Desktop.
Goal Seek analysis for a range with multiple Goals (VBA)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Reset_External_Marks() | |
'Select the external marks range | |
Range("E5:E13").Select | |
'Clear the external marks range | |
Selection.ClearContents | |
End Sub | |
Sub Goal_Seek_Range_MultipleGoal() | |
'Defining variable k | |
Dim k As Integer | |
'We are looping through each row in our table | |
For k = 5 To 13 | |
'Below is how we replicate the Goal Seek functionality via VBA | |
Cells(k, "F").GoalSeek Goal:=Cells(k, "H"), ChangingCell:=Cells(k, "E") | |
'Go to next iteration | |
Next k | |
End Sub |
what if I want my K variable to be a letter; as I want to use the goal seek function column-wise?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The excel file with demo for "Goal Seek analysis for a range with multiple Goals" is available at https://drive.google.com/open?id=1FSIDrRkYQV7sW_Eo8NDeDMPlNwc88krC