There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
VBA add circle to a cell


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
nczman's Avatar
Senior Member with 310 posts.
 
Join Date: Dec 2000
Location: Charlotte, NC USA
19-Sep-2003, 04:43 PM #1
Thumbs up VBA add circle to a cell
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
__________________
Revelation 4:1 After this I looked and, behold, a door was opened in heaven: and the first voice which I heard was as it were of a trumpet talking with me; which said, Come up hither....
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
19-Sep-2003, 05:14 PM #2
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
__________________
**Disclaimer** Anything below this line ^ is part of my signature for those that may be confused

Sadly, there are no integers on this scale, so your gangly adolescent attempt to be clever has proved futile....Dieter

I have the right "NOT" to be tolerant of others because they are different, weird, or tick me off.....Parody of Andy Rooney

There are no stupid questions, but there are a LOT of inquisitive idiots.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:25 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.