Skip to content

Instantly share code, notes, and snippets.

View excelcrafters's full-sized avatar

Thomas Koipuram excelcrafters

View GitHub Profile
@excelcrafters
excelcrafters / Goal_Seek_Multiple_Cells_Multiple_Goals.txt
Created May 30, 2019 09:07
Goal Seek analysis for a range with multiple Goals (VBA)
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
@excelcrafters
excelcrafters / Goal_Seek_Multiple_Cells.txt
Created May 25, 2019 09:30
Goal Seek analysis for multiple cells/range in Excel
Sub Goal_Seek_Range_SingleGoal()
'We are looping through each row in our table
For j = 5 To 13
'Below is how we replicate the Goal Seek functionality via VBA
'Cells(j, "F").GoalSeek - The cell that will hold our Goal value (in this case, Col F)
'Goal:=Cells(5, "H") - The value of our goal. In this case its referencing the value of Cell H5
'ChangingCell:=Cells(j, "E") - The input cell that needs to adjust its value inorder to achieve the goal
Cells(j, "F").GoalSeek Goal:=Cells(6, "H"), ChangingCell:=Cells(j, "E")
'Go to next iteration
Next j
@excelcrafters
excelcrafters / Macro_button_in_excel.txt
Created May 23, 2019 12:11
Macro button in excel
Sub HelloWorld()
MsgBox ("Hello World!")
End Sub