broman5000
02-03-2017, 11:18 AM
I'm drawing a blank here...essentially I want to highlight (I got that part RGB(255,0,0)) all cells if they greater than 10:30 (currently cells are formatted as general) see below
My spreadsheet looks like the following and my code is below...with no success :( Please help! data is in column Q
ACTUAL_TIME
10:14
11:37
8:21
10:32
11:04
11:49
Sub test()
Dim i As Long
Dim lastrow As Long
Dim lunch As Long
With ActiveSheet
lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
For i = 0 To lastrow - 2
If Range("BD5").Offset(i, 0).Value = "Y" And Range("Q5").Offset(i, 0).Value > TimeValue("10:30:00") Then
Range("R5").Offset(i, 0).EntireRow.Interior.Color = RGB(255, 0, 0)
Range("R5").Offset(i, 0).EntireRow.Font.Color = RGB(255, 255, 255)
Range("R5").Offset(i, 0).EntireRow.Font.Bold = True
lunch = lunch + 1
End If
Next i
End Sub
My spreadsheet looks like the following and my code is below...with no success :( Please help! data is in column Q
ACTUAL_TIME
10:14
11:37
8:21
10:32
11:04
11:49
Sub test()
Dim i As Long
Dim lastrow As Long
Dim lunch As Long
With ActiveSheet
lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
For i = 0 To lastrow - 2
If Range("BD5").Offset(i, 0).Value = "Y" And Range("Q5").Offset(i, 0).Value > TimeValue("10:30:00") Then
Range("R5").Offset(i, 0).EntireRow.Interior.Color = RGB(255, 0, 0)
Range("R5").Offset(i, 0).EntireRow.Font.Color = RGB(255, 255, 255)
Range("R5").Offset(i, 0).EntireRow.Font.Bold = True
lunch = lunch + 1
End If
Next i
End Sub