VBA to list hours from timesheet to another sheet

BraytonM

New Member
Joined
Jul 25, 2021
Messages
24
Office Version
  1. 365
Hello all,

I am back again asking another question on this forum. In the past, I have had great success with this forum (Shoutout @DanteAmor).

I am looking for a VBA to list the hours my timesheet (image attached)per person per job to Column J,K,L,M,N,O,P of Sheet 1 (minisheet) for each row that does not have a value in Column C.

I have attached another image of what would be displayed if this is possible. If this is not possible via VBA with what format of timesheet, I am not opposed to creating another worksheet/table so that it would work.

Any help/advise is welcome! I will be working on this all weekend more than likely.

Thank you!


PR TEMPLATE AUTOMATION EXAMPLE.xlsm
ABCDEFGHIJKLMNOP
1Employee NoWork RateUnique CountJob w/ TypeJob NoPhase NoCost CodeUnion NoEarn Code7/11/20217/12/20217/13/20217/14/20217/15/20217/16/20217/17/2021
2AAPPLESSTJOB2 U
3AAPPLESSTJOB2 CP
4AAPPLESSTJOB3 U
5AAPPLESSTJOB4 U
6AAPPLESSTJOB5 U
7AAPPLESST5
8AAPPLESRHJOB1 CP
9AAPPLESRHJOB2 CP
10AAPPLESRH2
11AAPPLESDTJOB1 CP
12AAPPLESDT1
13BBANANASTJOB2 U
14BBANANASTJOB2 CP
15BBANANASTJOB3 U
16BBANANASTJOB5 U
17BBANANAST4
18BBANANARHJOB2 CP
19BBANANARH1
20CCHERRYSTJOB2 U
21CCHERRYSTJOB2 CP
22CCHERRYSTJOB3 U
23CCHERRYSTJOB5 U
24CCHERRYST4
25CCHERRYRHJOB2 CP
26CCHERRYRH1
27DDOGSTJOB2 U
28DDOGSTJOB2 CP
29DDOGSTJOB4 U
30DDOGSTJOB5 U
31DDOGST4
32DDOGRHJOB2 CP
33DDOGRH1
34EELIPHANTSTJOB2 U
35EELIPHANTSTJOB2 CP
36EELIPHANTST2
37EELIPHANTRHJOB2 CP
38EELIPHANTRHJOB4 U
39EELIPHANTRHJOB5 U
40EELIPHANTRHJOB6 CP
41EELIPHANTRH4
42FFROGSTJOB2 U
43FFROGSTJOB2 CP
44FFROGSTJOB5 U
45FFROGSTJOB6 CP
46FFROGST4
47FFROGRHJOB2 CP
48FFROGRH1
49FFROGDTJOB4 U
50FFROGDT1
51GGORILLASTJOB2 U
52GGORILLASTJOB2 CP
53GGORILLASTJOB5 U
54GGORILLASTJOB6 CP
55GGORILLAST4
56GGORILLARHJOB2 CP
57GGORILLARH1
58GGORILLADTJOB4 U
59GGORILLADT1
60GGORILLAIWJOB7 U
61GGORILLAIW1
Sheet1
Cell Formulas
RangeFormula
J1:O1J1=K1-1
P1P1='MASTER TIMESHEET'!C7
A7A7=IF('MASTER TIMESHEET'!AI16=0,"",'MASTER TIMESHEET'!$C$16)
B7,B17B7=IF(A7<>"","ST","")
C7,C61,C59,C57,C55,C50,C48,C46,C41,C36,C33,C31,C26,C24,C19,C17,C12,C10C7=SUMPRODUCT((W7:AV7<>"")/COUNTIF(W7:AV7,W7:AV7&""))
A10A10=IF('MASTER TIMESHEET'!AI17=0,"",'MASTER TIMESHEET'!$C$16)
B10B10=IF($A$10<>"","RH","")
A12A12=IF('MASTER TIMESHEET'!AI18=0,"",'MASTER TIMESHEET'!$C$16)
B12B12=IF($A$12<>"","DT","")
A17A17=IF('MASTER TIMESHEET'!AI20=0,"",'MASTER TIMESHEET'!F20)
A19A19=IF('MASTER TIMESHEET'!AI21=0,"",'MASTER TIMESHEET'!F21)
B19B19=IF($A$19<>"","RH","")
A24A24=IF('MASTER TIMESHEET'!AI24=0,"",'MASTER TIMESHEET'!F24)
B24B24=IF($A$24<>"","ST","")
A26A26=IF('MASTER TIMESHEET'!AI25=0,"",'MASTER TIMESHEET'!F25)
B26B26=IF($A$26<>"","RH","")
A31A31=IF('MASTER TIMESHEET'!AI28=0,"",'MASTER TIMESHEET'!F28)
B31B31=IF($A$31<>"","ST","")
A33,A36A33=IF('MASTER TIMESHEET'!AI29=0,"",'MASTER TIMESHEET'!F29)
B33B33=IF($A$33<>"","RH","")
B36B36=IF($A$36<>"","ST","")
A41A41=IF('MASTER TIMESHEET'!AI33=0,"",'MASTER TIMESHEET'!F33)
B41B41=IF($A$41<>"","RH","")
A46A46=IF('MASTER TIMESHEET'!AI36=0,"",'MASTER TIMESHEET'!F36)
B46B46=IF($A$46<>"","ST","")
A48A48=IF('MASTER TIMESHEET'!AI37=0,"",'MASTER TIMESHEET'!F37)
B48B48=IF($A$48<>"","RH","")
A50A50=IF('MASTER TIMESHEET'!AI38=0,"",'MASTER TIMESHEET'!F38)
B50B50=IF($A$50<>"","DT","")
A55A55=IF('MASTER TIMESHEET'!AI40=0,"",'MASTER TIMESHEET'!F40)
B55B55=IF($A$55<>"","ST","")
A57A57=IF('MASTER TIMESHEET'!AI41=0,"",'MASTER TIMESHEET'!F41)
B57B57=IF($A$57<>"","RH","")
A59A59=IF('MASTER TIMESHEET'!AI42=0,"",'MASTER TIMESHEET'!F42)
B59B59=IF($A$59<>"","DT","")
A61A61=IF('MASTER TIMESHEET'!AI43=0,"",'MASTER TIMESHEET'!F43)
B61B61=IF($A$61<>"","IW","")
 

Attachments

  • Timesheet.PNG
    Timesheet.PNG
    83.4 KB · Views: 10
  • After-Macro.PNG
    After-Macro.PNG
    46.8 KB · Views: 8

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top