VBA add circle to a cell

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

nczman

Thread Starter
Joined
Dec 12, 2000
Messages
310
I am moving information from access to excel, and if the information in column j is greater or equal to 85, I am setting the font to bold. I have seen a spreadsheet that has placed a circle around the number instead of doing the bold. Manually, it would be autoshape,

Has anyone ever added a circle using code??

here is what I use.

If rstLeader![Wait3Min] >= 85 Then
.Range("j" & icol).Cells.Font.Bold = True
End If

Any ideas on how I could place a circle there instead?

Thanks much
 
Joined
Jul 29, 2001
Messages
21,334
There is a sample for doing this in an Access report and I would think it would work in Excel just as well....just create the function and call it.


Private Sub Detail0_Print(Cancel As Integer, PrintCount As Integer)

' Draw ellipse around controls that meet specified criteria.

Dim ctl As Control
Dim intPrintCircle As Integer
Dim sngAspect As Single, sngYOffset As Single
Dim intEllipseHeight As Integer, intElipseWidth As Integer
Dim sngXCoord As Single, sngYCoord As Single
Dim intI As Integer

' To yield desired ellipse, set sngAspect and sngYOffset
' according to the size and location of text boxes on

' subreport.
sngAspect = 0.23
sngYOffset = 200

' Determine height and width of ellipse.
intEllipseHeight = Me!Goal.Height * 1.1
intElipseWidth = Me!Goal.Width * 1.04
sngYCoord = (Me!Goal.Top + Me!Goal.Height) \ 2 + sngYOffset

' Loop through the controls that could be circled.
' If ctl is not Null, then determine if value is 90% or
' greater than value in Goal text box.
For intI = 1 To 4
Set ctl = Me("Qtr" & intI)
If Not IsNull(ctl) Then

intPrintCircle = (ctl >= 0.9 * Me!Goal)

' Determine coordinates of ctl and draw ellipse.
If intPrintCircle Then
sngXCoord = ctl.Left + (ctl.Width \ 2)
Me.Circle (sngXCoord, sngYCoord), intElipseWidth \ 2, , , , sngAspect
End If
End If
Next intI

End Sub
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top