Color change

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,062
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
I have sheet which contatins of Oval shape image like "Oval 1" and in sheet 1 cell D2 is less than =98% then then Oval 1 then outline should be red and if the cell value D2 is >98% then oval 1 share outline should change to green.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Set Target = Range("D2")
If Target.Value <= 98 Then
With Shapes("Oval 1")
    .Line.Weight = 3
    .Line.ForeColor.RGB = RGB(255, 0, 0)
    .Line.Visible = msoTrue
End With
    Else
With Shapes("Oval 1")
    .Line.Weight = 3
    .Line.ForeColor.RGB = RGB(0, 255, 0)
    .Line.Visible = msoTrue
End With
End If
End Sub
 
Upvote 0
Solution
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Set Target = Range("D2")
If Target.Value <= 98 Then
With Shapes("Oval 1")
    .Line.Weight = 3
    .Line.ForeColor.RGB = RGB(255, 0, 0)
    .Line.Visible = msoTrue
End With
    Else
With Shapes("Oval 1")
    .Line.Weight = 3
    .Line.ForeColor.RGB = RGB(0, 255, 0)
    .Line.Visible = msoTrue
End With
End If
End Sub
not sure its not working

my oval shape is in "Summary" sheet and cell value is form sheet 1
 
Upvote 0

Forum statistics

Threads
1,215,365
Messages
6,124,511
Members
449,166
Latest member
hokjock

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top