Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Form a circle (ie. color specific cells) given specific radius

I am trying to create a circle (ie. color specific cells in a spreadsheet)
based on a certain diameter (ie. 100 cells). This could be code (formula)
written in Visual Basic that would use the given diameter and automatically
selects cells to leave out of the circle (different color). I was wondering
if this is some way that has already been implemented previously or if there
is a formula (circle equation I believe, R^2 = X^2 + Y^2) that I could use in
VB and automatically apply it to spreadsheet cells and only color the cells
that would form a circle and leave other cells as is?

Your help is very much appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Form a circle (ie. color specific cells) given specific radius

Do you wish to color the interior of the circle or only its boundary?
--
Gary''s Student


"David" wrote:

I am trying to create a circle (ie. color specific cells in a spreadsheet)
based on a certain diameter (ie. 100 cells). This could be code (formula)
written in Visual Basic that would use the given diameter and automatically
selects cells to leave out of the circle (different color). I was wondering
if this is some way that has already been implemented previously or if there
is a formula (circle equation I believe, R^2 = X^2 + Y^2) that I could use in
VB and automatically apply it to spreadsheet cells and only color the cells
that would form a circle and leave other cells as is?

Your help is very much appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Form a circle (ie. color specific cells) given specific radius

Thanks for your help Gary,
The problem I am having is not how to color cells , it is what cells to
automatically select to create a circle, so when I color them, I would be
able to see the circle shape.
I think that I will need to decide on the size of the cell (ie. 1point wide
cell = x inch), then how many cells would fit in my desired diameter based on
the width set for all cells, then have a formula that would exclude some of
the cells on the outside of my circle and color them.
I am thinking that this is a visual basic code that needs to include all the
parameters mentioned above (cell size, diameter (how many cells), formula to
decide what cells to exclude then color them(so the coloring is just to
differentiate between the included and excluded cells in order to form a
circle)
I was wondering if somebody has already implemented some code to create a
circle based on parameters mentioned above.

Regards,
Dave


"Gary''s Student" wrote:

Do you wish to color the interior of the circle or only its boundary?
--
Gary''s Student


"David" wrote:

I am trying to create a circle (ie. color specific cells in a spreadsheet)
based on a certain diameter (ie. 100 cells). This could be code (formula)
written in Visual Basic that would use the given diameter and automatically
selects cells to leave out of the circle (different color). I was wondering
if this is some way that has already been implemented previously or if there
is a formula (circle equation I believe, R^2 = X^2 + Y^2) that I could use in
VB and automatically apply it to spreadsheet cells and only color the cells
that would form a circle and leave other cells as is?

Your help is very much appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Form a circle (ie. color specific cells) given specific radius

This routine calculates the distance from CV1000 (the center) and colors
cells that are within a circle. Of course, column width must be adjusted to
give the circular appearance:


Sub asdf()
For i = 900 To 1100
For j = 50 To 150
d = Sqr((i - 1000) ^ 2 + (j - 100) ^ 2)
If d < 50 Then
Cells(i, j).Interior.ColorIndex = 46
End If
Next
Next
End Sub
--
Gary''s Student


"David" wrote:

Thanks for your help Gary,
The problem I am having is not how to color cells , it is what cells to
automatically select to create a circle, so when I color them, I would be
able to see the circle shape.
I think that I will need to decide on the size of the cell (ie. 1point wide
cell = x inch), then how many cells would fit in my desired diameter based on
the width set for all cells, then have a formula that would exclude some of
the cells on the outside of my circle and color them.
I am thinking that this is a visual basic code that needs to include all the
parameters mentioned above (cell size, diameter (how many cells), formula to
decide what cells to exclude then color them(so the coloring is just to
differentiate between the included and excluded cells in order to form a
circle)
I was wondering if somebody has already implemented some code to create a
circle based on parameters mentioned above.

Regards,
Dave


"Gary''s Student" wrote:

Do you wish to color the interior of the circle or only its boundary?
--
Gary''s Student


"David" wrote:

I am trying to create a circle (ie. color specific cells in a spreadsheet)
based on a certain diameter (ie. 100 cells). This could be code (formula)
written in Visual Basic that would use the given diameter and automatically
selects cells to leave out of the circle (different color). I was wondering
if this is some way that has already been implemented previously or if there
is a formula (circle equation I believe, R^2 = X^2 + Y^2) that I could use in
VB and automatically apply it to spreadsheet cells and only color the cells
that would form a circle and leave other cells as is?

Your help is very much appreciated.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Form a circle (ie. color specific cells) given specific radius

Thanks gary, that worked.

"Gary''s Student" wrote:

This routine calculates the distance from CV1000 (the center) and colors
cells that are within a circle. Of course, column width must be adjusted to
give the circular appearance:


Sub asdf()
For i = 900 To 1100
For j = 50 To 150
d = Sqr((i - 1000) ^ 2 + (j - 100) ^ 2)
If d < 50 Then
Cells(i, j).Interior.ColorIndex = 46
End If
Next
Next
End Sub
--
Gary''s Student


"David" wrote:

Thanks for your help Gary,
The problem I am having is not how to color cells , it is what cells to
automatically select to create a circle, so when I color them, I would be
able to see the circle shape.
I think that I will need to decide on the size of the cell (ie. 1point wide
cell = x inch), then how many cells would fit in my desired diameter based on
the width set for all cells, then have a formula that would exclude some of
the cells on the outside of my circle and color them.
I am thinking that this is a visual basic code that needs to include all the
parameters mentioned above (cell size, diameter (how many cells), formula to
decide what cells to exclude then color them(so the coloring is just to
differentiate between the included and excluded cells in order to form a
circle)
I was wondering if somebody has already implemented some code to create a
circle based on parameters mentioned above.

Regards,
Dave


"Gary''s Student" wrote:

Do you wish to color the interior of the circle or only its boundary?
--
Gary''s Student


"David" wrote:

I am trying to create a circle (ie. color specific cells in a spreadsheet)
based on a certain diameter (ie. 100 cells). This could be code (formula)
written in Visual Basic that would use the given diameter and automatically
selects cells to leave out of the circle (different color). I was wondering
if this is some way that has already been implemented previously or if there
is a formula (circle equation I believe, R^2 = X^2 + Y^2) that I could use in
VB and automatically apply it to spreadsheet cells and only color the cells
that would form a circle and leave other cells as is?

Your help is very much appreciated.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Form a circle (ie. color specific cells) given specific radius

Hi,
How easy would it be to save this circle selection (as a range) and have it
fit in excel spreadsheet window that would appear so I do not have to look
for it.
this is because the circle is going to be different size each time I run the
program with different circle dimensions.
Thanks for your help,
Dave

"David" wrote:

Thanks gary, that worked.

"Gary''s Student" wrote:

This routine calculates the distance from CV1000 (the center) and colors
cells that are within a circle. Of course, column width must be adjusted to
give the circular appearance:


Sub asdf()
For i = 900 To 1100
For j = 50 To 150
d = Sqr((i - 1000) ^ 2 + (j - 100) ^ 2)
If d < 50 Then
Cells(i, j).Interior.ColorIndex = 46
End If
Next
Next
End Sub
--
Gary''s Student


"David" wrote:

Thanks for your help Gary,
The problem I am having is not how to color cells , it is what cells to
automatically select to create a circle, so when I color them, I would be
able to see the circle shape.
I think that I will need to decide on the size of the cell (ie. 1point wide
cell = x inch), then how many cells would fit in my desired diameter based on
the width set for all cells, then have a formula that would exclude some of
the cells on the outside of my circle and color them.
I am thinking that this is a visual basic code that needs to include all the
parameters mentioned above (cell size, diameter (how many cells), formula to
decide what cells to exclude then color them(so the coloring is just to
differentiate between the included and excluded cells in order to form a
circle)
I was wondering if somebody has already implemented some code to create a
circle based on parameters mentioned above.

Regards,
Dave


"Gary''s Student" wrote:

Do you wish to color the interior of the circle or only its boundary?
--
Gary''s Student


"David" wrote:

I am trying to create a circle (ie. color specific cells in a spreadsheet)
based on a certain diameter (ie. 100 cells). This could be code (formula)
written in Visual Basic that would use the given diameter and automatically
selects cells to leave out of the circle (different color). I was wondering
if this is some way that has already been implemented previously or if there
is a formula (circle equation I believe, R^2 = X^2 + Y^2) that I could use in
VB and automatically apply it to spreadsheet cells and only color the cells
that would form a circle and leave other cells as is?

Your help is very much appreciated.

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
Draw a circle in Excel with the radius and center from the contents of cells Marco[_2_] Charts and Charting in Excel 0 January 13th 09 11:12 PM
Selecting cells of a specific color only. David Excel Discussion (Misc queries) 9 February 14th 08 01:39 AM
clear specific cells in a form vdmbqb Excel Discussion (Misc queries) 1 November 24th 07 08:07 PM
How to draw a circle in excel with specific radius Mile Excel Worksheet Functions 1 April 13th 06 11:06 AM
Sum formula of cells with specific color value MSOChick Excel Worksheet Functions 2 December 9th 05 10:19 AM


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

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

About Us

"It's about Microsoft Excel"