Drawing a Circle if a different cell has data
PS
to toggle ALL circle borders on/off
ActiveSheet.Ovals.LineStyle = xlAutomatic ' xlNone
Regards,
Peter T
"Peter T" <peter_t@discussions wrote in message
...
Sub test()
Dim shp As Shape
Dim rng As Range
'run multiple times to test toggled value
' say the condition cell is right of the Y cell
' and the condition =1
Set rng = Range("B3") ' Change
With rng.Offset(0, 1)
.Value = IIf(.Value = 1, 0, 1) ' toggle value
End With
On Error Resume Next
Set shp = ActiveSheet.Shapes("Yes" & rng.Address(0, 0))
If shp Is Nothing Then
Set shp = ActiveSheet.Shapes.AddShape(msoShapeOval, 1, 1, 1, 1)
With shp
.Name = "Yes" & rng.Address(0, 0)
.Line.Weight = 0.75
.Line.DashStyle = msoLineSolid
.Line.Style = msoLineSingle
End With
End If
On Error GoTo 0
With rng
shp.Left = .Left + .Width / 2 - .Height / 2
shp.Top = .Top
shp.Width = .Height
shp.Height = .Height
shp.Fill.Visible = msoFalse
shp.Line.Visible = .Offset(0, 1) = 1
.Value = "Y"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
End Sub
Regards,
Peter T
"Steve R." wrote in message
...
Hello,
I need to draw a circle around a Y in a cell. If a differenct cell has
been
populated. I actually need to do this on several lines within the
worksheet.
Am using Excel 2002. If the test cell is empty I just need the Y with no
circle.
Thanks
|