Automatically inserting shapes into cells based on cell value or conditional formatting?

Grenamier

New Member
Joined
Oct 11, 2017
Messages
2
Hello,

I have a simple grid where the rows are people and columns are weeks. There are formulas in the grid that count how many audits a given person has done in a given week and I've conditionally formatted the cells to turn green when the cell is >= 1. I've been asked specifically to put a red dot in each cell that's 0. Is there a way to do this without manually copying and pasting red circles over each cell? I imagine this can be done by looping and drawing in VBA, but I'd prefer as simple as solution as possible.

Thanks!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Does this help? You should be able to adapt as necessary. Sorry I couldn't do the loop etc as I'm off home now.

Code:
Sub addCircle(r As Range)
    Dim s As Shape
    
    'add shape to the top left of the cell with a size of 10,10
    Set s = Me.Shapes.AddShape(Type:=msoShapeOval, Left:=r.Left, Top:=r.Top, Width:=10, Height:=10)
    
    'Make it red
    s.Fill.ForeColor.RGB = RGB(255, 0, 0)
    
    
End Sub


Sub test()
    'Change 'B1' to any cell
    addCircle [B1]
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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