ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Color a cell When Change Is Made (https://www.excelbanter.com/excel-discussion-misc-queries/127370-color-cell-when-change-made.html)

Zorro

Color a cell When Change Is Made
 
I have used the following:

Private Sub Worksheet_Change(ByVal Target As Range)
Target.Interior.ColorIndex = 8
End Sub

But what I really want to do is to color the entire row in one color and the
changed cell in another.

Any code out there please?

TIA
Zorro



bigwheel

Color a cell When Change Is Made
 
Add the line: Target.EntireRow.Interior.ColorIndex = 3


"Zorro" wrote:

I have used the following:

Private Sub Worksheet_Change(ByVal Target As Range)
Target.Interior.ColorIndex = 8
End Sub

But what I really want to do is to color the entire row in one color and the
changed cell in another.

Any code out there please?

TIA
Zorro




George Nicholson

Color a cell When Change Is Made
 
Private Sub Worksheet_Change(ByVal Target As Range)
Target.EntireRow.Interior.ColorIndex = 37
Target.Interior.ColorIndex = 8
End Sub

HTH,


"Zorro" wrote in message
.uk...
I have used the following:

Private Sub Worksheet_Change(ByVal Target As Range)
Target.Interior.ColorIndex = 8
End Sub

But what I really want to do is to color the entire row in one color and
the changed cell in another.

Any code out there please?

TIA
Zorro




Chip Pearson

Color a cell When Change Is Made
 
I would add a safeguard to ensure that Target is only one row tall.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Rows.Count = 1 Then
Target.EntireRow.Interior.ColorIndex = 37
Target.Interior.ColorIndex = 8
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"George Nicholson" wrote in message
...
Private Sub Worksheet_Change(ByVal Target As Range)
Target.EntireRow.Interior.ColorIndex = 37
Target.Interior.ColorIndex = 8
End Sub

HTH,


"Zorro" wrote in message
.uk...
I have used the following:

Private Sub Worksheet_Change(ByVal Target As Range)
Target.Interior.ColorIndex = 8
End Sub

But what I really want to do is to color the entire row in one color and
the changed cell in another.

Any code out there please?

TIA
Zorro






Zorro

Color a cell When Change Is Made
 
Thanks for that. One problem though. I can only highlight one change per row
using the code below. Is there a way to highlight a number of cells on the
same row as they are changed. They may not neccessarily be contiguous.

Private Sub Worksheet_Change(ByVal Target As Range)
Target.EntireRow.Interior.ColorIndex = 3
Target.Interior.ColorIndex = 8
End Sub

Cheers
Zorro


"bigwheel" wrote in message
...
Add the line: Target.EntireRow.Interior.ColorIndex = 3


"Zorro" wrote:

I have used the following:

Private Sub Worksheet_Change(ByVal Target As Range)
Target.Interior.ColorIndex = 8
End Sub

But what I really want to do is to color the entire row in one color and
the
changed cell in another.

Any code out there please?

TIA
Zorro






David McRitchie

Color a cell When Change Is Made
 
If the coloring is only to help identify the cell during
the time that it is selected see Chip's
RowLiner addin
http://www.cpearson.com/excel/RowLiner.htm

"Chip Pearson"
I would add a safeguard to ensure that Target is only one row tall.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Rows.Count = 1 Then
Target.EntireRow.Interior.ColorIndex = 37
Target.Interior.ColorIndex = 8
End If
End Sub






All times are GMT +1. The time now is 08:48 AM.

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