Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Drawing a Circle if a different cell has data

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Drawing a Circle if a different cell has data

an idea
on another sheet, with gridlines hidden, make a "Y"
then, away from the first one, make the "Y" with a transparent circle
around it.
copy each area & paste to MSPaint, or something, as a picture file.
save. copy picture file into excel. hide that worksheet.

if xxxx <"" then
show y picture
else
show ycircle picture
end if

:)
susan


On Jun 29, 3:00 pm, Steve R. wrote:
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Drawing a Circle if a different cell has data

That might work, but was hoping for a withing spreadsheet option. I know I
can create a macro that will display the circle, but havent figured out how
to run that macro if there is data in the other cell.

"Susan" wrote:

an idea
on another sheet, with gridlines hidden, make a "Y"
then, away from the first one, make the "Y" with a transparent circle
around it.
copy each area & paste to MSPaint, or something, as a picture file.
save. copy picture file into excel. hide that worksheet.

if xxxx <"" then
show y picture
else
show ycircle picture
end if

:)
susan


On Jun 29, 3:00 pm, Steve R. wrote:
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Drawing a Circle if a different cell has data

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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Drawing a Circle if a different cell has data


Peter
This is close to what I need, have to expand on my original post though.
This will be for a range of cells G25 - G32 and the cell I am testing is A25
- A32 How would that change the code you posted?

Thanks
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Drawing a Circle if a different cell has data

Sub test2()
Dim bCondition As Boolean
Dim n As Long
Dim rngY As Range
Dim rngC, cel As Range
Dim shp As Shape

Set rngC = Range("A25:A32") ' test cells
Set rngY = Range("G25:G32") 'Y circle cells

rngC.Value = 0

n = 0
bCondition = False
For Each cel In rngY
n = n + 1
On Error Resume Next
Set shp = Nothing
Set shp = ActiveSheet.Shapes("Yes" & cel.Address(0, 0))

If shp Is Nothing Then
Set shp = ActiveSheet.Shapes.AddShape(msoShapeOval, 1, 1, 1, 1)
On Error GoTo 0
With shp
.Name = "Yes" & cel.Address(0, 0)
.Line.Weight = 0.75
.Line.DashStyle = msoLineSolid
.Line.Style = msoLineSingle
End With
End If
On Error GoTo 0

bCondition = rngC(n, 1) = 1 ' test is true if the test cell = 1 but change
With rngY(n, 1)
shp.Left = .Left + .Width / 2 - .Height / 2
shp.Top = .Top
shp.Width = .Height
shp.Height = .Height
shp.Fill.Visible = msoFalse
shp.Line.Visible = bCondition

.Value = "Y"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
Next
End Sub

Regards,
Peter T

"Steve R." wrote in message
...

Peter
This is close to what I need, have to expand on my original post though.
This will be for a range of cells G25 - G32 and the cell I am testing is

A25
- A32 How would that change the code you posted?

Thanks



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Drawing a Circle if a different cell has data

On Fri, 29 Jun 2007 12:00:00 -0700, Steve R.
wrote:

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


There is a Windows supplied font editor that you could use to create such a
character. Then use a simple IF statement:

e.g.

A1: =IF(LEN(B1)=0,"Y","<your_special_character")


There is the Private Character Editor supplied with Windows.
You can create custom characters with it and make them part
of one or more fonts.
In "Run" enter: eudcedit.exe
You will have to read the help file.
--ron
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Drawing a Circle if a different cell has data


Peter
That did the trick, I did need to use it on different sheets, with different
locations, but I managed to figure that part out. Thanks for your help

Steve
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Drawing a Circle if a different cell has data

Ron
Thanks for this info. Won't do me much good in this instance as the program
for this will be run on several systems. But is good to know

Steve
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set Circle Size from cell data? Colby Excel Discussion (Misc queries) 2 April 11th 07 04:56 PM
How do I make circle within circle graphs in Excel 2003? Lance Charts and Charting in Excel 2 December 5th 06 01:59 AM
drawing/printing an exact circle talisman New Users to Excel 4 October 23rd 05 11:39 PM
Drawing a circle on a protected sheet Tonso Excel Discussion (Misc queries) 3 April 9th 05 09:22 PM
Drawing a semi-circle in Excel Shilps Excel Programming 7 July 25th 04 01:50 AM


All times are GMT +1. The time now is 11:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"