VBA code to plot Efficient Frontier

mattcrow

New Member
Joined
Feb 10, 2022
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hi there,

I am a beginner to VBA and looking to run code that will do the following:

- copy an expected return from a list of expected returns (B766:B789)
- paste it as a target return in B762 .
- run solver (I know to use SolverSolve and that it needs to be referenced)
- copy the resulting standard deviation value from B760. There is a formula on this as a sqrt of variance.
- paste that Standard Deviation value alongside the corresponding expected return in the table.
- Repeat the same process for all expected returns given in the list (key step which I am struggling with!)

Ideally this can be done for an arbitrary number of expected returns - i.e. the list may be longer/shorter than 24.

I provide an image of the xlsm file - any and all help would be greatly appreciated!

Many Thanks,
Matt
 

Attachments

  • VBA needed.JPG
    VBA needed.JPG
    114.8 KB · Views: 10

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I suggest to google:
VBA code to plot Efficient Frontier filetype:xlsm
 
Upvote 0

Forum statistics

Threads
1,214,936
Messages
6,122,340
Members
449,079
Latest member
rocketslinger

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