dfwconsumables
New Member
- Joined
- Sep 21, 2017
- Messages
- 4
I have a worksheet, there is currently 14 columns with information in them, only 6 of the columns are important. There are currently 3,500 rows in the workbook. I have created a macro that loops through column E and highlights the range C:N for any value greater than 1. That value is in a summed row in Column E (like a pivot table). Call that summed amount the variable i, I would like to offset the row up, so a negative i and then highlight columns C:N. I have tried 10 differing ways, but I just can't get my code code to work. My code snippet is below, please help with any comments, I'm new to this so please be gentle.
Sub VerificationLine()
Dim i As Long, r1 As Range, r2 As Range
FinalRow = Cells(Rows.Count, 3).End(xlUp).Row
For i = 3 To FinalRow
Set r1 = Range("e" & i)
Set r2 = Range("C" & i & ":N" & i)
If r1.Value = 1 Then r2.Interior.Color = xlNone
If r1.Value > 1 Then r2.Interior.Color = vbYellow
Next i
End Sub
Sub VerificationLine()
Dim i As Long, r1 As Range, r2 As Range
FinalRow = Cells(Rows.Count, 3).End(xlUp).Row
For i = 3 To FinalRow
Set r1 = Range("e" & i)
Set r2 = Range("C" & i & ":N" & i)
If r1.Value = 1 Then r2.Interior.Color = xlNone
If r1.Value > 1 Then r2.Interior.Color = vbYellow
Next i
End Sub