This may be a simple solution and I may be overthinking it...
I have a column that contains hours devoted to a project and another column that sates the maximum hours spent on the project. The goal is to high light red when the devoted hours have exceeded the set maximum hours. Currently I have the following code.
Sub HighlightOT()
Dim rng As Range
For Each rng In Worksheets(2).Range("D:D")
If rng.Value > 120 Then
rng.Interior.Color = vbRed
End If
Next rng
For Each rng In Worksheets(3).Range("D:D")
If rng.Value > 120 Then
rng.Interior.Color = vbRed
End If
Next rng
For Each rng In Worksheets(4).Range("D:D")
If rng.Value > 120 Then
rng.Interior.Color = vbRed
End If
Next rng
For Each rng In Worksheets(5).Range("D:D")
If rng.Value > 120 Then
rng.Interior.Color = vbRed
End If
Next rng
End Sub
The macro is across four sheets and each sheet has column D as devoted hours and if the hours exceed 120 high light red. What I want is to replace 120hrs with a column on each sheet that I can cross check to column D. Not all rows will have 120hrs they will vary.
if someone can help that would be great!
I have a column that contains hours devoted to a project and another column that sates the maximum hours spent on the project. The goal is to high light red when the devoted hours have exceeded the set maximum hours. Currently I have the following code.
Sub HighlightOT()
Dim rng As Range
For Each rng In Worksheets(2).Range("D:D")
If rng.Value > 120 Then
rng.Interior.Color = vbRed
End If
Next rng
For Each rng In Worksheets(3).Range("D:D")
If rng.Value > 120 Then
rng.Interior.Color = vbRed
End If
Next rng
For Each rng In Worksheets(4).Range("D:D")
If rng.Value > 120 Then
rng.Interior.Color = vbRed
End If
Next rng
For Each rng In Worksheets(5).Range("D:D")
If rng.Value > 120 Then
rng.Interior.Color = vbRed
End If
Next rng
End Sub
The macro is across four sheets and each sheet has column D as devoted hours and if the hours exceed 120 high light red. What I want is to replace 120hrs with a column on each sheet that I can cross check to column D. Not all rows will have 120hrs they will vary.
if someone can help that would be great!