PDA

View Full Version : Macro that highlights specific rows yellow if a cell is green and a date varies



Vulgerius
09-05-2016, 02:43 AM
Dear community,
I am very new to the topic of macro programming and VBA but have a, in my oppinion, complex topic to solve in Excel 2010.
The problem: I would like to highlight every row where a certain project number is identitcal IF a certain name is identical and a cell has a specific colour AND if the date varies to much (everything up to 14 days in the future):

What I am working now:
Sub Macro1 ()
If G2 = Q2 AND N2 = range.Interior.Color = RGB(146, 208, 80) And Countif(L2, "<=" &L3:L4-14) Then
cell.EntireRow.Interior.Color = RGB(255, 255, 0)
Else

End If


So I have a solution if a certain cell is identical to another and if a color of a different cell in the same row is green and if a date of a different cell varies to much from the start date. But this depends on the project and there can be 1 or 5 guys with the same project and every single one should be controlled if the date varies too much from the guy that has the identical cells and the green color in his row. And if thatīs the case every row with the specific project number should have the color yellow.

So again: If two cells in a row are the same and the background color of a third cell is green the macro should search and check the worksheet for persons with the same projectnumber and should check if the date varies 14 days from a specific date in the row with the green background cell. And if thatīs the case every row with the selected project number should be yellow.

:)

Best regards
Robert

SamT
09-05-2016, 06:43 AM
I think you need to upload an example workbook. Use the "Go Advanced" button below the post editor.

Vulgerius
09-05-2016, 08:28 AM
Thx for the info:


Sub Macro4()
'
' Macro4 Macro
'
'
IF(G2=Q2) AND N2 = Range.Interior.Color = RGB (146, 208, 80) AND Countif (L2, "<", L3:L4-14) Then
cell.EntireRow.Interior.Color = RGB(255, 255, 0)
End If



Range("Q2").Select
Selection.AutoFill Destination:=Range("Q2:Q1225")
Range("Q2:Q1225").Select
End Sub

SamT
09-05-2016, 09:22 AM
I think you need to upload an example workbook. Use the "Go Advanced" button below the post editor

Vulgerius
09-06-2016, 12:48 AM
17027 sorry for the mess.