Change colour of cells when content is altered/changed BUT NOT TO INSERTED OR DELETED ROWS

M

Martin ©¿©¬

Hi
The group previously helped me with a code that changes the colour of
cells when the content is edited/changed and it works well
Thank you
===================================================
Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)
Target.Interior.ColorIndex = 8
End Sub
==========
What I would like is to further enhance the code so that it DOESN'T
make a colour change to inserted or deleted rows, but still allows the
cell colour change when the content is edited/changed
Is this possible ?
 
G

Gord Dibben

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Cells.Count > 1 Then Exit Sub
If .Value <> "" Then
.Interior.ColorIndex = 8
End If
End With
End Sub


Gord Dibben MS Excel MVP
 
M

Martin ©¿©¬

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Cells.Count > 1 Then Exit Sub
If .Value <> "" Then
.Interior.ColorIndex = 8
End If
End With
End Sub

Thank you very much Gord
This does a great job and saves a lot of extra work removing coloured
lines the previous code left behind when inserting & deleting lines
It's a great time saver
 
G

Gord Dibben

Good to hear.

Thanks for the feedback.

Gord

Thank you very much Gord
This does a great job and saves a lot of extra work removing coloured
lines the previous code left behind when inserting & deleting lines
It's a great time saver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top