Link to home
Start Free TrialLog in
Avatar of JoshinHtown
JoshinHtownFlag for United States of America

asked on

Forecast function in Excel VBA

I would to use the FORECAST function in excel VBA.  I have a spreadsheet called "Sheet1" that has the information I need.  Forecast requires X, known_y's, known_x's   So for X Sheet1 has cell D7 that contains this value.  For known_y's Sheet1 has E3 to E4 for this.  And known_x's has E7 to E8.  Can someone show me how to code this in VBA?

Regards,
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JoshinHtown

ASKER

Yes it is.  I'm just trying to get an idea as to how to call that particular function in vba is all.  Thanks
Oh I forgot to mention.  I'm going to store the outcome in a textbox so would it be Textbox1 = application.forecast([d7], [e3:e4], [e7:e8]) ?  and how does it know to point to Sheet1 for this?
Assuming you set a variable of type Worksheet...

Textbox1 = application.forecast(ws.[d7], ws.[e3:e4], ws.[e7:e8])