cell protection

S

spandit

i have protected the sheet but still if i copy one cell and paste on another,
the format of the first cell gets replaced by copied cell. how can i avoid
this
 
K

Kevin B

Right click on the target cell, select PASTE SPECIAL and select the FORMULA
option if pasting a formula, or the VALUE option if just pasting values.
 
G

Gord Dibben

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

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
 

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

Similar Threads

protect cell format 1
Protect Cells 10
Merge Cell Cut & Paste 1
Protected Excel Worksheet 1
Formatting not protected when paste 7
copy cells but lock editing 5
Hidden cells 2
problem with fractions to decimal 1

Top