do you have to use a macro?
You could probably do this with formulas
if the number of sales is constant and the last cell with a cell is in A20
for example (previous cells in A1:A19)
the "n" entered in B1
in B2
=AVERAGE(OFFSET($A$20,-B1+1,0,B1,1))
To set a cell to a value with VBA
Range("B2").Value = "Some Value"
--
Regards,
Tom Ogilvy
smartee628 wrote in message
...
I'm a college student working on a project and i'm completely
inexperienced with excel programming so any kind of help will be
greatly appreciated.
Here's the scenario: I'm doing a program to forecast demands. I have
a column showing the actual sales and another column showing the
forecasts. On a separate cell I have the formula for calculating the
forecast based on what the user inputs as 'n' (i.e If user enters n=2,
then take the 2 most recent sales and divide them by n=2, etc.)
How do I program my 'Submit' button so that the calculated value is
reflected on my forecast column as the most recent forecasted value and
make it repeat the process for the next forecast. (i.e. Calculate
forecast, click Submit, enter to C15...do the same process of
calculating, click Submit, enter to C16 and so on).
Thanks.
------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/
~~Now Available: Financial Statements.xls, a step by step guide to
creating financial statements