VBA Coding

ADJ2RGJ

New Member
Joined
Feb 7, 2025
Messages
2
Office Version
  1. 365
Platform
  1. Windows
1) Question relates to implementing a VBA code within a standard Excel 365 spreadsheet (size A1:AB1000). Column headers in row 1.
2) Date field in column B (format dd.mm.yyyy)
3) Datedif between entry in column B and Now() shown in column Y (in months)
4) 1st routine - If y2 > 9 then interior colour of (entire) row = "yellow"
5) 2nd routine - If y2 < 6 then interior colour of (entire) row = "blue"
6) 3rd routine - If y2 > 6 < 9 then interior colour of (entire) row = "white"
7) 4th routine - if text column O = "complete" and text in column P = "complete" 1st then interior colour of (entire) row = "grey"
8) In the case of '7' the row colour would automatically update on column data change
9) Items '3' to '6' should automatically update when the spreadsheet is opened.

Any advice would be helpful.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi and welcome to MrExcel

Your request can be resolved with conditional formatting, create a rule for each color. You don't need to run any macros and the colors update automatically.

DANTE AMOR
ABCNOPQXYZAAABAC
1ABCNOPQXYZAB
223-ene15
324-eneComplete14
425-eneComplete13
526-eneCompleteComplete12
627-ene11
728-ene10
829-ene9
930-eneCompleteComplete8
1031-ene7
1101-febComplete6
1202-feb5
1303-febCompleteComplete4
1404-feb3
15
Hoja4
Cell Formulas
RangeFormula
Y2:Y14Y2=DATEDIF(B2,TODAY(),"d")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:AB100Expression=$Y2=""textYES
A2:AB100Expression=AND($O2="Complete",$P2="Complete")textNO
A2:AB100Expression=$Y2>9textNO
A2:AB100Expression=$Y2<6textNO
A2:AB100Expression=AND($Y2>=6,$Y2<=9)textNO



😇
 
Upvote 0
Thank you very much. I had seen similar questions to mine in the past where the answer had been to loop through every row, but appreciate your approach and answer.
 
Upvote 0

Forum statistics

Threads
1,226,365
Messages
6,190,548
Members
453,611
Latest member
JRM59

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