ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to apply colouring as in Cells associated with Forumla (https://www.excelbanter.com/excel-programming/335618-how-apply-colouring-cells-associated-forumla.html)

news.microsoft.com[_8_]

How to apply colouring as in Cells associated with Forumla
 
hi,

When there is a sum formula applied to a cell for example

cell A5 = Cell A1 + Cell A2 + Cell A3+ Cell A4

and when we click on cell A5 each of the cells that are part of the formula
is given various random (i think so) colours

How can i do the same programatically? My goal is not to apply formula but
to show cells or range of cells in various kind of colours temporarily. I am
looking for a solution where i dont have to work with cell border colours..

Please let me know if my question is not clear.

Any pointers in this regard will be very helpful

Regards,
Abhilash




Rowan[_2_]

How to apply colouring as in Cells associated with Forumla
 
If you have no other coloured cells on the sheet (as their formatting will be
cleared) you could try a selection change event like this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Cell As Range
Dim i As Integer
Application.EnableEvents = False
Cells.Interior.ColorIndex = False
If Target.Count = 1 Then
On Error Resume Next
i = 37
For Each Cell In Target.Precedents
If i = 47 Then i = 33
Cell.Interior.ColorIndex = i
i = i + 1
Next Cell
On Error GoTo 0
End If
Application.EnableEvents = True
End Sub

Hope this helps
Rowan

In case you are unfamiliar with worksheet events right click the sheet tab,
select view code and paste the code.


"news.microsoft.com" wrote:

hi,

When there is a sum formula applied to a cell for example

cell A5 = Cell A1 + Cell A2 + Cell A3+ Cell A4

and when we click on cell A5 each of the cells that are part of the formula
is given various random (i think so) colours

How can i do the same programatically? My goal is not to apply formula but
to show cells or range of cells in various kind of colours temporarily. I am
looking for a solution where i dont have to work with cell border colours..

Please let me know if my question is not clear.

Any pointers in this regard will be very helpful

Regards,
Abhilash





RarrMike

How to apply colouring as in Cells associated with Forumla
 

Are these completely random colors, or is it like if the value of th
cell is under 10, you want it green, and if valu eis above 10 is red?
If the latter is true, you can apply conditional formatting to thes
cells. To use conditional formatting, highlight the cells you wan
formatted, click on Format, then click Conditional Formatting. It i
pretty self-explanatory from that point, however, if you have troubl
just let me know and I can explain it a little further

--
RarrMik
-----------------------------------------------------------------------
RarrMike's Profile: http://www.excelforum.com/member.php...fo&userid=2563
View this thread: http://www.excelforum.com/showthread.php?threadid=39048


news.microsoft.com[_8_]

How to apply colouring as in Cells associated with Forumla
 
Hello,

First thank you for your reply. I think i didnt express my question well.
Acutally i dont need to color within a cell because the cells may already
have colors that i should not modify

What i want is kind of highlight the boundary of cell or range of cells
using various (random colours) to differentiate cells or range. I dont want
to change the existing border color either. What is want is similar to what
Excel shows when you click on a cell that depends upon other cells for
example in summation, a kind of blue boundray which appears or if there are
many non continous cells it shows it in various colors.

Is this possible programmatically?

Regards
Abhilash


"Rowan" wrote in message
...
If you have no other coloured cells on the sheet (as their formatting will
be
cleared) you could try a selection change event like this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Cell As Range
Dim i As Integer
Application.EnableEvents = False
Cells.Interior.ColorIndex = False
If Target.Count = 1 Then
On Error Resume Next
i = 37
For Each Cell In Target.Precedents
If i = 47 Then i = 33
Cell.Interior.ColorIndex = i
i = i + 1
Next Cell
On Error GoTo 0
End If
Application.EnableEvents = True
End Sub

Hope this helps
Rowan

In case you are unfamiliar with worksheet events right click the sheet
tab,
select view code and paste the code.


"news.microsoft.com" wrote:

hi,

When there is a sum formula applied to a cell for example

cell A5 = Cell A1 + Cell A2 + Cell A3+ Cell A4

and when we click on cell A5 each of the cells that are part of the
formula
is given various random (i think so) colours

How can i do the same programatically? My goal is not to apply formula
but
to show cells or range of cells in various kind of colours temporarily. I
am
looking for a solution where i dont have to work with cell border
colours..

Please let me know if my question is not clear.

Any pointers in this regard will be very helpful

Regards,
Abhilash







news.microsoft.com[_8_]

How to apply colouring as in Cells associated with Forumla
 
Hello,

First thank you for your reply. I think i didnt express my question well.
Acutally i dont need to color within a cell because the cells may already
have colors that i should not modify

What i want is kind of highlight the boundary of cell or range of cells
using various (random colours) to differentiate cells or range. I dont want
to change the existing border color either. What is want is similar to what
Excel shows when you click on a cell that depends upon other cells for
example in summation, a kind of blue boundray which appears or if there are
many non continous cells it shows it in various colors.

Is this possible programmatically?

Regards,
Abhilash

"RarrMike" wrote in
message ...

Are these completely random colors, or is it like if the value of the
cell is under 10, you want it green, and if valu eis above 10 is red?
If the latter is true, you can apply conditional formatting to these
cells. To use conditional formatting, highlight the cells you want
formatted, click on Format, then click Conditional Formatting. It is
pretty self-explanatory from that point, however, if you have trouble
just let me know and I can explain it a little further.


--
RarrMike
------------------------------------------------------------------------
RarrMike's Profile:
http://www.excelforum.com/member.php...o&userid=25637
View this thread: http://www.excelforum.com/showthread...hreadid=390481




news.microsoft.com[_8_]

How to apply colouring as in Cells associated with Forumla
 
Hello,

First thank you for your reply. I think i didnt express my question well.
Acutally i dont need to color within a cell because the cells may already
have colors that i should not modify

What i want is kind of highlight the boundary of cell or range of cells
using various (random colours) to differentiate cells or range. I dont want
to change the existing border color either. What is want is similar to what
Excel shows when you click on a cell that depends upon other cells for
example in summation, a kind of blue boundray which appears or if there are
many non continous cells it shows it in various colors.

Is this possible programmatically?

Regards
Abhilash


"Rowan" wrote in message
...
If you have no other coloured cells on the sheet (as their formatting will
be
cleared) you could try a selection change event like this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Cell As Range
Dim i As Integer
Application.EnableEvents = False
Cells.Interior.ColorIndex = False
If Target.Count = 1 Then
On Error Resume Next
i = 37
For Each Cell In Target.Precedents
If i = 47 Then i = 33
Cell.Interior.ColorIndex = i
i = i + 1
Next Cell
On Error GoTo 0
End If
Application.EnableEvents = True
End Sub

Hope this helps
Rowan

In case you are unfamiliar with worksheet events right click the sheet
tab,
select view code and paste the code.


"news.microsoft.com" wrote:

hi,

When there is a sum formula applied to a cell for example

cell A5 = Cell A1 + Cell A2 + Cell A3+ Cell A4

and when we click on cell A5 each of the cells that are part of the
formula
is given various random (i think so) colours

How can i do the same programatically? My goal is not to apply formula
but
to show cells or range of cells in various kind of colours temporarily. I
am
looking for a solution where i dont have to work with cell border
colours..

Please let me know if my question is not clear.

Any pointers in this regard will be very helpful

Regards,
Abhilash







news.microsoft.com[_8_]

How to apply colouring as in Cells associated with Forumla
 
Hello,

First thank you for your reply. I think i didnt express my question well.
Acutally i dont need to color within a cell because the cells may already
have colors that i should not modify

What i want is kind of highlight the boundary of cell or range of cells
using various (random colours) to differentiate cells or range. I dont want
to change the existing border color either. What is want is similar to what
Excel shows when you click on a cell that depends upon other cells for
example in summation, a kind of blue boundray which appears or if there are
many non continous cells it shows it in various colors.

Is this possible programmatically?

Regards,
Abhilash
"RarrMike" wrote in
message ...

Are these completely random colors, or is it like if the value of the
cell is under 10, you want it green, and if valu eis above 10 is red?
If the latter is true, you can apply conditional formatting to these
cells. To use conditional formatting, highlight the cells you want
formatted, click on Format, then click Conditional Formatting. It is
pretty self-explanatory from that point, however, if you have trouble
just let me know and I can explain it a little further.


--
RarrMike
------------------------------------------------------------------------
RarrMike's Profile:
http://www.excelforum.com/member.php...o&userid=25637
View this thread: http://www.excelforum.com/showthread...hreadid=390481




David McRitchie

How to apply colouring as in Cells associated with Forumla
 
You can use Conditional Formatting to color the borders.
Remove the Conditional Formatting and the colors all
return to normal.

I don't know anything about your seeing different colors
in the cells that are named in the formulas. What version of
Excel do yo have.

You can in any version of Excel see cell dependencies.
tools, customize, left tab is toolbars, click on Auditing toolbars.
You can then check out cell dependencies.


---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"news.microsoft.com" wrote in message ...
Hello,

First thank you for your reply. I think i didnt express my question well.
Acutally i dont need to color within a cell because the cells may already
have colors that i should not modify

What i want is kind of highlight the boundary of cell or range of cells
using various (random colours) to differentiate cells or range. I dont want
to change the existing border color either. What is want is similar to what
Excel shows when you click on a cell that depends upon other cells for
example in summation, a kind of blue boundray which appears or if there are
many non continous cells it shows it in various colors.

Is this possible programmatically?

Regards,
Abhilash
"RarrMike" wrote in
message ...

Are these completely random colors, or is it like if the value of the
cell is under 10, you want it green, and if valu eis above 10 is red?
If the latter is true, you can apply conditional formatting to these
cells. To use conditional formatting, highlight the cells you want
formatted, click on Format, then click Conditional Formatting. It is
pretty self-explanatory from that point, however, if you have trouble
just let me know and I can explain it a little further.


--
RarrMike
------------------------------------------------------------------------
RarrMike's Profile:
http://www.excelforum.com/member.php...o&userid=25637
View this thread: http://www.excelforum.com/showthread...hreadid=390481







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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com