Hi,
I have 4 ratings : Highly Engaged, Moderately Engaged, Barely Engaged, and Disengaged. What I need is to write a macro that change the text colors in a text box with conditions, and below macro works perfectly fine, however, I need to add another condition, which is "if BE (Barely Engaged) & DI (Disengaged) are more than 0.03 then turn the color to Red" and if BE & DI less than 0.03 then turn them to blue, otherwise make them black. How should I add this condition to below macro? or do you suggest another macro?
Sub Manager_Eng()
Dim t2Sht As Worksheet
Set t2Sht = Sheets("Themes_2")
t2Sht.Activate
Dim ME_shps As Variant, Me_shp As Shape
ME_shps = Array("HE", "ME", "BE", "DI")
For Each itm In ME_shps
Set Me_shp = ActiveSheet.Shapes(itm & "_AMS_18")
With Me_shp
If Val(.TextFrame.Characters.Text) / 100 < -0.03 Then
.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(255, 0, 0)
ElseIf Val(.TextFrame.Characters.Text) / 100 > 0.03 Then
.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 255)
Else: .TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 0)
End If
End With
Next itm
End Sub
Thank you!
I have 4 ratings : Highly Engaged, Moderately Engaged, Barely Engaged, and Disengaged. What I need is to write a macro that change the text colors in a text box with conditions, and below macro works perfectly fine, however, I need to add another condition, which is "if BE (Barely Engaged) & DI (Disengaged) are more than 0.03 then turn the color to Red" and if BE & DI less than 0.03 then turn them to blue, otherwise make them black. How should I add this condition to below macro? or do you suggest another macro?
Sub Manager_Eng()
Dim t2Sht As Worksheet
Set t2Sht = Sheets("Themes_2")
t2Sht.Activate
Dim ME_shps As Variant, Me_shp As Shape
ME_shps = Array("HE", "ME", "BE", "DI")
For Each itm In ME_shps
Set Me_shp = ActiveSheet.Shapes(itm & "_AMS_18")
With Me_shp
If Val(.TextFrame.Characters.Text) / 100 < -0.03 Then
.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(255, 0, 0)
ElseIf Val(.TextFrame.Characters.Text) / 100 > 0.03 Then
.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 255)
Else: .TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 0)
End If
End With
Next itm
End Sub
Thank you!