#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default cell protection

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default cell protection

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.
--
Kevin Backmann


"spandit" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default cell protection

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

On Thu, 5 Jun 2008 08:04:01 -0700, spandit
wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password Protection - paste to unprotected cell locks the cell Jimbob Excel Discussion (Misc queries) 7 September 7th 07 06:22 PM
cell protection, how to? S S Excel Worksheet Functions 2 June 17th 07 11:44 AM
Cell Protection vs. Worksheet Protection kmwhitt Excel Discussion (Misc queries) 4 September 24th 06 02:37 AM
Cell protection Gregg Johnson Excel Worksheet Functions 5 July 20th 06 08:56 AM
Cell Protection SusanM Excel Discussion (Misc queries) 1 November 23rd 05 09:25 PM


All times are GMT +1. The time now is 03:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"