Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Forecast function in Excel VBA

Posted on 2007-10-19
4
Medium Priority
?
2,685 Views
Last Modified: 2012-08-14
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,
0
Comment
Question by:JoshinHtown
  • 2
  • 2
4 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 20112068
Debug.Print Application.Forecast([d7], [e3:e4], [e7:e8])

BTW, basing your forecast off of just two data points is incredibly risky, no?
0
 

Author Comment

by:JoshinHtown
ID: 20112137
Yes it is.  I'm just trying to get an idea as to how to call that particular function in vba is all.  Thanks
0
 

Author Comment

by:JoshinHtown
ID: 20112168
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?
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 20112211
Assuming you set a variable of type Worksheet...

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a serious pitfall that can happen when deleting shapes using VBA.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Screencast - Getting to Know the Pipeline

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question