Currently, I am fairly new to creating Excel Macros. I have been using the Macro Recorder and editing the macros to be a bit more versatile for my duties at work.
I am trying to automate a few things and as well trying to add some things to a report to make it easier for my backup if I am ever out sick or on vacation.
What I am trying to do is have conditional formatting set through a macro that will Highlight the entire row if the value in Col D (Rows 6 - final row with data) match / duplicate the value in Col F (F6 - final row with data) *Ignoring the first occurrence if there is more than 1*
Currently, I have the below code that I got from stackoverflow though it only highlights the Cell that is a duplicate, but I can't seem to figure out how to convert it to highlight the full row:
Any help with this will be great. I know I can use conditional formatting within excel but automating this into a macro would be easier than teaching my backup how to do this.
Dim lastRow As Long Dim sheetName As String sheetName = "Main Report" lastRow = Sheets(sheetName).Range("D" & Rows.Count).End(xlUp).Row For lRow = 6 To lastRow If Sheets(sheetName).Cells(lRow, "D") = Sheets(sheetName).Cells(lRow, "F") Then Sheets(sheetName).Cells(lRow, "D").Interior.ColorIndex = 3 End If Next lRow