Macro VBA Code to Sub Total a Date Range

Darkfox

New Member
Joined
Jun 24, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I am having a few issues with setting up a Macro to then subtotal my values within a date range. Please see the pic:
1656085794632.png


So I have a time sheet which I run a Marco to make it look like the above image. This is for time entries for a 2 week period, but the data is dynamic as each employee may work on various items within a day and have various tasks to report (ie. Employee 1 did 20 tasks within a week, Employee 2 did 50 tasks within a week). What I want to do from this standpoint is have a macro VBA code that will subtotal each week of data Sunday to Saturday for a 2 week period or use the dates as the range point with A4 as the beginning date, what ever is easier. Basically the above pic represents that data listed from the most recent date (June 11th, 2022) and extends down to the furthest date (ie. Monday May 30th).

What I need:
- Insert a row below the first range of data (Week 1 - Sunday to Saturday or June 5th - June 11)
- Subtotal the amounts (hours) in column G
- Insert a row below the first range of data (Week 2 - Sunday to Saturday or May 29th - June 4)
- Subtotal the amounts (hours) in column G

Let me know if you require further information or if I am not clear.

Thanks in advance.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,214,839
Messages
6,121,891
Members
449,058
Latest member
Guy Boot

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