Home>Blogs>VBA>Goal Seek in Excel using VBA
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-

Meet PK, the founder of PK-AnExcelExpert.com! With over 15 years of experience in Data Visualization, Excel Automation, and dashboard creation. PK is a Microsoft Certified Professional who has a passion for all things in Excel. PK loves to explore new and innovative ways to use Excel and is always eager to share his knowledge with others. With an eye for detail and a commitment to excellence, PK has become a go-to expert in the world of Excel. Whether you're looking to create stunning visualizations or streamline your workflow with automation, PK has the skills and expertise to help you succeed. Join the many satisfied clients who have benefited from PK's services and see how he can take your Excel skills to the next level!