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: 11

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I suggest to google:
VBA code to plot Efficient Frontier filetype:xlsm
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,938
Members
449,197
Latest member
k_bs

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