VBA, clear a specific area by date and time, and move 'below' area up.

NollException

New Member
Joined
Jul 24, 2022
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Ok new user here.
There have been a few posts about clearing parts of the excel by a date.
Tried some but have not helped me sadly.

Let's say i got a timetable, i want to trim it with a button, and in column E i got the date (2022-07-24) for example formatted. and in column F i got the time (22:45).
And when you click said trim button, it would remove all rows which the current date and time have passed, minus one row. (So there is atleast one row of the previous data left).
And when it trim, it would trim row 1 to 23, but only column A to J, then move row 24 and below up, to fill the gap.

Made a example sheet. In that scenario, lets say its the date 24th of July, 2022. And time is after 10:30. Then it would clear row 1-13 (A to J), and move row 14 and below(A to J) up to "take its place".

Thanks in advance
/N
 

Attachments

  • example.jpg
    example.jpg
    175.1 KB · Views: 5

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

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