david2005wang
New Member
- Joined
- Apr 8, 2022
- Messages
- 13
- Office Version
- 2021
- 2019
- 2013
- Platform
- Windows
I have "manpower plan" sheet, and the No. lists in Column "A from 1 to N (example is from 1 to 3), Month in row 2 from 1 to M (example is from “E” to “P”).
Each time, I need to calculate the subtotal Manpower for each of Team (from 1 to N) including grant total for all teams by each month from 1 to M.
I plan to use VBA codes introduced by two buttons ("insert subtotal", and "grand total") to meet the following purpose.
1 When I click “insert subtotal” button after I put the mouse cursor in the position of active cell (the location of Sub-total) below last row of each team, it will insert one row, copy the format of above row and auto input “Sub-Total” words into the active cell, Change the background color of the row into grey, Draw a thick line under the sub-total row, and finally auto input the subtotal formular to calculate and fill the number of the sub-sum for each of month of each team.
2. when click the “grand total” button, will auto input the grand total formular to calculate and fill the number of the grand sum for each of month of all team.
I try some codes but didn't work well, so, could any expert help me with specific codes to meet the above targets.
Each time, I need to calculate the subtotal Manpower for each of Team (from 1 to N) including grant total for all teams by each month from 1 to M.
I plan to use VBA codes introduced by two buttons ("insert subtotal", and "grand total") to meet the following purpose.
1 When I click “insert subtotal” button after I put the mouse cursor in the position of active cell (the location of Sub-total) below last row of each team, it will insert one row, copy the format of above row and auto input “Sub-Total” words into the active cell, Change the background color of the row into grey, Draw a thick line under the sub-total row, and finally auto input the subtotal formular to calculate and fill the number of the sub-sum for each of month of each team.
2. when click the “grand total” button, will auto input the grand total formular to calculate and fill the number of the grand sum for each of month of all team.
I try some codes but didn't work well, so, could any expert help me with specific codes to meet the above targets.
Manpower Plan.xlsm | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | |||
1 | Well Pads Construction Manpower Plan | ED+ Month | ||||||||||||||||||||
2 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | ||||||||||
3 | No. | Category | Plan to Start | Plan to End | ||||||||||||||||||
4 | 1 | Project Management Team | ||||||||||||||||||||
5 | 1.1 | Deputy Project Manager | ED+2 | ED+12 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |||||||
6 | 1.2 | Construction Manager | ED+10 | ED+12 | 1 | 1 | 1 | |||||||||||||||
7 | 1.3 | Site Manager | ED+6 | ED+12 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |||||||||||
8 | Sub-Total | 0 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 3 | 3 | 3 | |||||||||
9 | 2 | Geotechnical Team | ||||||||||||||||||||
10 | 2.1 | Team Leader | ED+1 | ED+9 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |||||||||
11 | 2.2 | Geotechnical Engineer | ED+1 | ED+3 | 2 | 2 | 2 | |||||||||||||||
12 | 2.3 | Topographic Engineer | ED+1 | ED+8 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | ||||||||||
13 | 2.4 | Drilling machine operator | ED+1 | ED+11 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | |||||||
14 | 2.5 | Labour | ED+1 | ED+3 | 12 | 12 | 12 | |||||||||||||||
15 | 2.6 | Administrator | ED+1 | ED+12 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | ||||||
16 | Sub-Total | 23 | 23 | 23 | 9 | 9 | 9 | 9 | 9 | 7 | 6 | 6 | 2 | |||||||||
17 | 3 | Camp Installation Team | ||||||||||||||||||||
18 | 3.1 | Site Manager | ED+10 | ED+10 | 1 | |||||||||||||||||
19 | 3.2 | Construction Engineer | ED+10 | ED+10 | 1 | |||||||||||||||||
20 | 3.3 | QHSE Engineer | ED+10 | ED+10 | 1 | |||||||||||||||||
21 | Sub-Total | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 0 | |||||||||
22 | Grand Total | 23 | 24 | 24 | 10 | 10 | 11 | 11 | 11 | 9 | 12 | 9 | 5 | |||||||||
Manpower Plan |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E21:P21,E8:P8 | E8 | =SUBTOTAL(9,E4:E7) |
E16:P16 | E16 | =SUBTOTAL(9,E10:E15) |
E22:P22 | E22 | =SUBTOTAL(9,E4:E21) |