VBA Help Please

victorski

New Member
Joined
Nov 27, 2024
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hello brains trust,

I'm hoping someone can help me.

I have a workbook that I use to manage a project - I have 3 sheets, 'Overdue' (Sheet3), 'Priority Master List' (Sheet4) and 'Completed' (Sheet10)

The priority master list has activities listed in it - I created a macro that copies an entire row to the 'Overdue' when 'Days Left' is less than or equal to '5'.

Sub MoveData()
Sheet4.Range("A1:G1").AutoFilter
Sheet4.[G1:G150].AutoFilter Field:=7, Criteria1:="<=5"
Sheet4.[A1:G150].Copy Sheet3.[A1]
Sheet4.[A1].AutoFilter
End Sub

This seems to work good for my purposes.

I would also like the macro to move rows to the 'Completed' sheet and then delete it from the 'Master Priority List' when a date inputted into the 'END' field.

Could anyone please help me with this?

I also have a manager who reviews my workbook and doesn't know how to run the macro - is it possible to program it run automatically rather than manually running it?

Any help would be greatly appreciated.

Victor

Priority Master List Mini-sheet:

IDLMP Works Schedule EXTRA TEST.xlsm
ABCDEFGHI
1PriorityTaskCommentsASSIGNED TOPROGRESSDUEDAYS LEFTSTARTEND
2
3110%31/12/202433
41.10%15/12/202417
5110%31/12/202433
61.20%15/12/202417
71.20%20/01/202553
81.20%20/01/202553
91.20%15/12/202417
101.30%20/12/202422
111.40%31/12/2025398
121.40%15/12/202417
131.40%20/01/202553
141.40%20/01/202553
151.40%15/12/202417
161.40%1/03/202593
171.55%31/12/202433
181.50%15/12/202417
191.50%20/01/202553
201.50%20/01/202553
211.595%15/12/202417
221.50%15/11/2024-13
231.50%15/11/2024-13
241.520%6/11/2024-22
251.510%30/10/2024-29
261.50%23/11/2024-5
27
282.10%31/12/202433
292.10%7/11/2024-21
302.10%20/01/202553
312.20%31/12/20271128
322.30%31/12/20271128
332.40%31/12/202433
342.50%31/12/20271128
35
363.10%12/03/2025104
373.20%11/02/202575
383.30%3/03/202595
39
404.10%3/12/20245
414.10%8/10/2024-51
424.10%8/11/2024-20
434.20%
444.30%
454.40%3/12/20245
464.40%8/10/2024-51
474.40%8/11/2024-20
484.50%14/01/202547
494.60%
505
515.1100%24/07/202424/07/2024
525.20%3/03/202595
535.295%15/10/2024-4415/08/202424/10/2024
545.20%
555.20%31/10/2024-28
565.20%15/12/202417
575.290%31/10/2024-28
585.20%5/12/20247
595.20%5/12/20247
605.20%10/12/202412
615.20%20/01/202553
625.30%3/03/202595
636
646.190%4/12/20246
Priority Master List
Cell Formulas
RangeFormula
G3:G26,G64,G55:G62,G52:G53,G45:G48,G40:G42,G36:G38,G28:G34G3=F3-TODAY()
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I5Expression=AND($G5<>"",$G5<=5)textNO
I3Expression=AND($G3<>"",$G3<=5)textNO
I10Expression=AND($G10<>"",$G10<=5)textNO
I4Expression=AND($G4<>"",$G4<=5)textNO
I6:I9Expression=AND($G6<>"",$G6<=5)textNO
E64Other TypeDataBarNO
E64Expression=AND($G64<>"",$G64<=5)textNO
E28Other TypeDataBarNO
E31:E34Other TypeDataBarNO
E55:E56Other TypeDataBarNO
E57:E62,E51:E54Other TypeDataBarNO
E29:E30Other TypeDataBarNO
D67:I154,D14:I63,D3:H13,I11:I13Expression=AND($G3<>"",$G3<=5)textNO
E18:E20Other TypeDataBarNO
E21:E26,D63,E35:E49,E3:E17,E54Other TypeDataBarNO



Overdue Mini-sheet:
IDLMP Works Schedule EXTRA TEST.xlsm
ABCDEFG
1PriorityTaskCommentsASSIGNED TOPROGRESSDUEDAYS LEFT
21.50%15/11/2024-13
31.50%15/11/2024-13
41.520%6/11/2024-22
51.510%30/10/2024-29
61.50%23/11/2024-5
72.10%7/11/2024-21
84.10%3/12/20245
94.10%8/10/2024-51
104.10%8/11/2024-20
114.40%3/12/20245
124.40%8/10/2024-51
134.40%8/11/2024-20
14595%15/10/2024-44
1550%31/10/2024-28
16590%31/10/2024-28
Overdue
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E15Other TypeDataBarNO
E14,E16Other TypeDataBarNO
E7Other TypeDataBarNO
D19:G104,D2:G16Expression=AND($G2<>"",$G2<=5)textNO
E8:E13,E2:E6Other TypeDataBarNO


Completed Mini-sheet:
IDLMP Works Schedule EXTRA TEST.xlsm
ABCDEFGHI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Completed
 

Attachments

  • VBA Help.PNG
    VBA Help.PNG
    23.9 KB · Views: 2
Just an FYI...

You use "msht.Rows.End(xlDown).Row"
to get to the last row of your data.

I got caught out by this a few times, so instead, I now ALWAYS use:
msht.Rows(Rows.Count).End(xlUp).Row.

Your formula gets the wrong information if there's a blank row.
It can also lead to truly slow processing if there is only one row to copy (xlDown goes to row 10,000,000-odd)
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I think that I messed this up... It appears that it works using column A, and if that's blank it fails.

The last row (which MAY be a blank row, but at least it's past the last one) is:
VBA Code:
msht.Range("A1").SpecialCells(xlLastCell).Row
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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