Goal Seek Using Macro

Goal Seek in Excel using VBA

In this article, we have used a Goal Seek to get required minimum sales to meet the Sales % target using VBA. You can use this method for other purpose also.

Input your number in left table and yellow highlighted field and click on GetMinimum Sales button.

Goal Seek Using Macro

Watch this step by step video to Goal Seek using VBA-

Below is the macro code –

Option Explicit

Sub Goal_Seek()

Dim sh As Worksheet

Set sh = ThisWorkbook.Sheets("Goal Seek")

sh.Range("K13").GoalSeek goal:=sh.Range("E5").Value, changingcell:=sh.Range("G10")

sh.Range("G10").NumberFormat = "0"

End Sub


Click here to download practice file-

My Name is PK. I am founder of PK-AnExcelExpert.com. I am a Microsoft Certified Professional. I have more than 12 years of experience in Data Visualization, Excel Automation and dashboard creation. Excel is my passion and I like to do always something innovative in Excel and share it with other people.