Thread: Draw a cirle
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rowan Drummond[_3_] Rowan Drummond[_3_] is offline
external usenet poster
 
Posts: 414
Default Draw a cirle

Hi Wayne

The code Carlos gave you is worksheet event code so make sure that you
have pasted it in the code module associated with the sheet not a normal
module. Right click the sheet tab and select View Code to get the
correct code sheet.

Target is the range selected. The way Carlos had his code the circle
will be drawn in whichever cell is selected. If you want a circle in L7
any time the user clicks on a new cell then maybe:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call Circle_(Range("L7"))
End Sub

Hope this helps
Rowan

Wayne wrote:
Hi Carlos
Thanks for the help but I'm having problems getting this to work.

Hoe do i set the target sell to "L7" for example?

I tried inserting...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("L7").Select
Call Circle_(Target)
End Sub




"Carlos" wrote:


Hi Wayne try

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call Circle_(Target)
End Sub

Sub Circle_(oCell As Range)

l = oCell.Left
t = oCell.Top
h = oCell.Height
w = oCell.Width

Set Circlee = ActiveSheet.Shapes.AddShape(msoShapeOval, l, t, w, h)

With Circlee
.Fill.Solid
.Fill.ForeColor.RGB = RGB(0, 0, 0)

.Line.Weight = 0.5
.Line.DashStyle = msoLineSolid
.Line.Style = msoLineSingle
.Line.ForeColor.RGB = RGB(255, 255, 255)
.Line.BackColor.RGB = RGB(255, 255, 255)
End With

Set Circlee = Nothing
End Sub

more properties see Object browser

"Wayne" wrote in message
...

How do I draw a cirle in a cell when it is selected?