background colour.

S

shiro

I have some cells with background colour.
I want the background colour change automatically
when the value of the cell being updated,but when
printing the the sheet,the background colour is disappear.
How to do that?
The cell position is random.
Thank's id advance.

Rgds,

Shiro.
 
S

Stephen Newman

From Chip Pearson's site:

Put the following code in 'thisWorkbook'. The selected cell in all
your sheets will then change color, and the cell which was left will
revert back to no color.



Option Explicit

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Excel.Range)
Static OldCell As Range

If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
End If

Target.Interior.ColorIndex = 6

Set OldCell = Target

End Sub
 
S

shiro

Mr Stephen,
Appreciated your help.I have not visited Mr Chip's page,
just hope I'll get the answer here.

I need more condition,I want turn the OldCell colour to
another colour if the cell's value was updated by user,
if it's not updated the colour is xlColorIndexNone,how to
modify the code?
Thank's in advance.

Rgds,

Shiro
 

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