Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Draw a circle in Excel with the radius and center from the contents of cells | Charts and Charting in Excel | |||
Selecting cells of a specific color only. | Excel Discussion (Misc queries) | |||
clear specific cells in a form | Excel Discussion (Misc queries) | |||
How to draw a circle in excel with specific radius | Excel Worksheet Functions | |||
Sum formula of cells with specific color value | Excel Worksheet Functions |