VBA - Method not available?

Ash1432

New Member
Joined
Apr 20, 2021
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
I am really trying to learn VBA coding, and I am a super beginner. I'm watching a video where the person records a macro using the Goal seek functionaltiy. The VBA that was created is Range("B4".GoalSeek Goal:= 500, ChangingCell:=Range ("B3")

I can recreate the recording of the macro and get the same outcome. But since I want to learn VBA I was trying to create this macro without the recorder. When I do this and I type Range("B4:). Goal seek is not listed or showing as being available to use. Can someone explain why that would be?

1647029168927.png
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
There is no why. It's just one of those quirks. You have to first type "R.GoalSeek". Then it will show you the syntax

1647031529408.png

VBA Code:
Sub GSVBAExample()
    Dim R As Range, CC As Range
    
    Set CC = ActiveSheet.Range("A1") 'changing cell
    Set R = ActiveSheet.Range("B1")  'result cell
    
    CC.Value = 0
    R.Formula = "=" & CC.Address(False, False) & "*2+10" 'create a formula for the example
    
    R.GoalSeek Goal:=100, ChangingCell:=CC
    
    MsgBox "CC Value for R = 100 is " & CC.Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,471
Messages
6,125,000
Members
449,202
Latest member
Pertotal

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