View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How can colour of cell shading be fixed to one colour

You could use this event code to retain the Formatting of the target cells.

Note: does not work if cells are CUT and pasted

Private Sub Worksheet_Change(ByVal Target As Range)
'retain formatting when a cell is copied over
Dim myValue
With Application
.EnableEvents = False
myValue = Target.Value
.Undo
Target = myValue
.EnableEvents = True
End With
End Sub

Right-click on the sheet tab and "View Code". Copy/paste the code into that
sheet module.

Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP

On Tue, 23 Sep 2008 03:00:01 -0700, Tabrez
wrote:

How can colour of cell shading be fixed to one colour and it does not changes
when new contents are pasted in that cell.