ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro Start (https://www.excelbanter.com/excel-discussion-misc-queries/118587-macro-start.html)

zephyr

Macro Start
 
Week numbers 1 to 7 are in Row 5 Columns L to U.
The data for each week is in Row 8 Columns L to U.

I basically have a macro to do this (this will be expanded to cover the 52
weeks).

Range("D9").Select
ActiveCell.FormulaR1C1 = "=R[-1]C[17]"
Range("E9").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-1]C[14]:R[-1]C[16])"
Range("F9").Select
ActiveCell.FormulaR1C1 =
"=SUM(R[-1]C[6]:R[-1]C[10],R[-1]C[13]:R[-1]C[15])"
Range("I17").Select
End Sub

The macro above is only an example.

What I would like to do is to have a macro start when the week number is
typed into cell D8 and the data is extracted and put into the relevant cells
detailed below.

Cell D9 has the data for that particular week
For week 1 it is cell L8. For week 6 it would be T8.

Cell E9 has the data added together for each week in the month.
So if I select February Week 7, week 5, 6 and 7 (S8:U8) are added together
and put in Cell F9.

Many thanks in advance



All times are GMT +1. The time now is 11:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com