Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Lock formatting

Hi, how can I set up a cell/group of cells so that the data in them can be
changes but the formatting cannot. For instance if I put the number
formatting as a percentage to 5 decimal places, then even if someone
copy/pastes something from a different cell that is not in that format, the
cell will take the new input without taking the formatting...

Thanks
HF
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Lock formatting

Copy and paste only........

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


Gord Dibben MS Excel MVP

On Thu, 25 Oct 2007 15:54:00 -0700, hfazal
wrote:

Hi, how can I set up a cell/group of cells so that the data in them can be
changes but the formatting cannot. For instance if I put the number
formatting as a percentage to 5 decimal places, then even if someone
copy/pastes something from a different cell that is not in that format, the
cell will take the new input without taking the formatting...

Thanks
HF


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Lock formatting

Not sure how to apply this?

"Gord Dibben" wrote:

Copy and paste only........

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


Gord Dibben MS Excel MVP

On Thu, 25 Oct 2007 15:54:00 -0700, hfazal
wrote:

Hi, how can I set up a cell/group of cells so that the data in them can be
changes but the formatting cannot. For instance if I put the number
formatting as a percentage to 5 decimal places, then even if someone
copy/pastes something from a different cell that is not in that format, the
cell will take the new input without taking the formatting...

Thanks
HF



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Lock formatting

Right-click on the sheet tab and "View Code"

Copy/paste into that sheet module.


Gord

On Fri, 7 Dec 2007 17:19:00 -0800, hfazal
wrote:

Not sure how to apply this?

"Gord Dibben" wrote:

Copy and paste only........

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


Gord Dibben MS Excel MVP

On Thu, 25 Oct 2007 15:54:00 -0700, hfazal
wrote:

Hi, how can I set up a cell/group of cells so that the data in them can be
changes but the formatting cannot. For instance if I put the number
formatting as a percentage to 5 decimal places, then even if someone
copy/pastes something from a different cell that is not in that format, the
cell will take the new input without taking the formatting...

Thanks
HF




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
How do I lock in formatting on a worksheet RogueBiscuit Excel Discussion (Misc queries) 9 December 23rd 06 01:13 AM
How can I Lock Formatting? Scott Excel Worksheet Functions 1 January 13th 06 11:12 PM
Lock just formatting? JLC Excel Discussion (Misc queries) 1 October 12th 05 12:32 AM
Lock in formatting Derek Y via OfficeKB.com Excel Worksheet Functions 2 July 29th 05 02:33 AM
How to lock worksheet formatting? TANDEX Excel Worksheet Functions 1 May 6th 05 09:36 PM


All times are GMT +1. The time now is 10:02 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"