powerpivotlegal
New Member
- Joined
- May 14, 2014
- Messages
- 30
Hello Experts,
I need help with a macro that cycles through one column ("Week-Ending Date") of a formatted table that users are updating each week to find unique values (e.g. "6/25/2016 or "7/9/2016") in that column and then highlighting the first row with that unique value up and through certain columns rather than just the entire row.
Currently, I've managed to come up with a macro (seen below) that highlights all rows for a specific value rather than highlighting only the first row of the unique value.
In addition, the macro in another thread highlights all unique values in every row/cell rather than specific column.
http://www.mrexcel.com/forum/excel-...applications-highlight-unique-values-row.html
Sub Macro1()
Const TEST_COLUMN As String = "h" '<=== change to suit
Dim LastRow As Long
Dim cell As Range
sSheetName = ActiveSheet.Name
With Worksheets(sSheetName)
LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For Each cell In Range("h2:h" & LastRow)
If cell.Value = "6/25/2016" Then
cell.Offset(, -7).Resize(, 11).Interior.ColorIndex = 53
Else
cell.EntireRow.Interior.ColorIndex = xlNone
End If
Next
End With
End Sub
Cheers
I need help with a macro that cycles through one column ("Week-Ending Date") of a formatted table that users are updating each week to find unique values (e.g. "6/25/2016 or "7/9/2016") in that column and then highlighting the first row with that unique value up and through certain columns rather than just the entire row.
Currently, I've managed to come up with a macro (seen below) that highlights all rows for a specific value rather than highlighting only the first row of the unique value.
In addition, the macro in another thread highlights all unique values in every row/cell rather than specific column.
http://www.mrexcel.com/forum/excel-...applications-highlight-unique-values-row.html
Sub Macro1()
Const TEST_COLUMN As String = "h" '<=== change to suit
Dim LastRow As Long
Dim cell As Range
sSheetName = ActiveSheet.Name
With Worksheets(sSheetName)
LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For Each cell In Range("h2:h" & LastRow)
If cell.Value = "6/25/2016" Then
cell.Offset(, -7).Resize(, 11).Interior.ColorIndex = 53
Else
cell.EntireRow.Interior.ColorIndex = xlNone
End If
Next
End With
End Sub
Cheers