Hello everyone.
I have the following table:
...and the following code:
Resuming, this code comments cells on range B4:B8,B12:B16 depending on their values, with the remarks of each vehicle referenced on the table on the right. So far, the code runs awesome, thanks to Fluff's help here on MrExcel.
However, I'd like to mark the cells on the range according to the type of remark: green for light stuff, yellow, and red for serious stuff.
I have other macros to help me do that:
- paint_green
- paint_yellow
- paint_red
- clear_paint
At that point on the code where I comented I was stalled, I would like the code to do the following:
in each row/"um":
if value on column F = Range("I4").Value Then Call paint_green
if value on column F = Range("I5").Value Then Call paint_yellow
if value on column F = Range("I6").Value Then Call paint_red
Thanks in advance for any help on this, best regards and stay safe,
Vasco.
I have the following table:
...and the following code:
VBA Code:
Sub vabtroni()
Dim um As Range
With CreateObject("scripting.dictionary")
For Each um In Range("E4:E8")
If um.Value <> "" Then
.Item(um.Value) = um.Offset(, 2).Value
.Item(um.Value + 50) = um.Offset(, 2).Value
End If
Next um
For Each um In Range("B4:B8,B12:B16")
If Not um.Comment Is Nothing Then
um.Comment.Delete
um.Select
Call clear_paint
End If
If .Exists(um.Value) And .Item(um.Value) <> "" Then
um.AddComment
um.Comment.Text .Item(um.Value)
um.Select
' AND THIS IS WHERE I'M STALLED
End If
Next um
End With
End Sub
Resuming, this code comments cells on range B4:B8,B12:B16 depending on their values, with the remarks of each vehicle referenced on the table on the right. So far, the code runs awesome, thanks to Fluff's help here on MrExcel.
However, I'd like to mark the cells on the range according to the type of remark: green for light stuff, yellow, and red for serious stuff.
I have other macros to help me do that:
- paint_green
- paint_yellow
- paint_red
- clear_paint
At that point on the code where I comented I was stalled, I would like the code to do the following:
in each row/"um":
if value on column F = Range("I4").Value Then Call paint_green
if value on column F = Range("I5").Value Then Call paint_yellow
if value on column F = Range("I6").Value Then Call paint_red
Thanks in advance for any help on this, best regards and stay safe,
Vasco.