Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Is it possible to lock-in or freeze formatting?

I often am able to set up my excel tables in advance - Borders, bold or
italic cells, etc. and then later when the data is available I often am
copying and pasting values from other worksheets and formulas from with in my
own sheet. Unfortuntly when pasting I lose my formatting.

Is it possible to lock-in the formatting at some point before I begin
putting in data? It would save me a huge amount of time.


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Is it possible to lock-in or freeze formatting?

Paste SpecialValues will paste just the data without overwriting any
formatting.

There is a Paste SpecialValues button you can place on your Toolbar.

ToolsCustomizeEdit.......scroll down until you see a paste icon with the
number 12 on it. Drag to your Toolbar.

Or you could place event code in the target
worksheet that preserves the formatting when anything is copied into it.

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

This is sheet event code. Right-click on the target sheet tab and "View Code".

Copy/paste into that sheet module. Alt + q to return to the Excel sheet window.

You can now copy from source sheet and paste to target sheet with no disruption
of target sheet formatting.


Gord Dibben MS Excel MVP

On Wed, 2 Jan 2008 14:24:03 -0800, smccarvi
wrote:

I often am able to set up my excel tables in advance - Borders, bold or
italic cells, etc. and then later when the data is available I often am
copying and pasting values from other worksheets and formulas from with in my
own sheet. Unfortuntly when pasting I lose my formatting.

Is it possible to lock-in the formatting at some point before I begin
putting in data? It would save me a huge amount of time.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Is it possible to lock-in or freeze formatting?

After trying out the code this week, it doesnt quite do what I need. One
problem is that it always pastes values when I often need to paste formulas;
another is that I can no longer "undo" which I need because I make a lot of
mistakes.

I noticed that after pasting a clipboard appears with an option to "Match
Destination Formatting". Could the code be modified to always have anything
that is pasted match the destination format?




"Gord Dibben" wrote:

Paste SpecialValues will paste just the data without overwriting any
formatting.

There is a Paste SpecialValues button you can place on your Toolbar.

ToolsCustomizeEdit.......scroll down until you see a paste icon with the
number 12 on it. Drag to your Toolbar.

Or you could place event code in the target
worksheet that preserves the formatting when anything is copied into it.

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

This is sheet event code. Right-click on the target sheet tab and "View Code".

Copy/paste into that sheet module. Alt + q to return to the Excel sheet window.

You can now copy from source sheet and paste to target sheet with no disruption
of target sheet formatting.


Gord Dibben MS Excel MVP

On Wed, 2 Jan 2008 14:24:03 -0800, smccarvi
wrote:

I often am able to set up my excel tables in advance - Borders, bold or
italic cells, etc. and then later when the data is available I often am
copying and pasting values from other worksheets and formulas from with in my
own sheet. Unfortuntly when pasting I lose my formatting.

Is it possible to lock-in the formatting at some point before I begin
putting in data? It would save me a huge amount of time.




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Is it possible to lock-in or freeze formatting?

I don't know how to access and change the default of the Paste Options button.

You may have to go to a macro rather than the sheet event code.

This should do what you want but only if the copied range is-contiguous.

Sub copy_no_change()
Dim rng1 As Range
Dim rng2 As Range
Set rng1 = Selection
Set rng2 = Application.InputBox(prompt:= _
"Select Any Cell to paste to", Type:=8)
rng2.Resize(rng1.Rows.Count, rng1.Columns.Count).Formula _
= rng1.Formula
End Sub


Gord


On Fri, 4 Jan 2008 12:44:01 -0800, smccarvi
wrote:

After trying out the code this week, it doesn’t quite do what I need. One
problem is that it always pastes values when I often need to paste formulas;
another is that I can no longer "undo" which I need because I make a lot of
mistakes.

I noticed that after pasting a clipboard appears with an option to "Match
Destination Formatting". Could the code be modified to always have anything
that is pasted match the destination format?




"Gord Dibben" wrote:

Paste SpecialValues will paste just the data without overwriting any
formatting.

There is a Paste SpecialValues button you can place on your Toolbar.

ToolsCustomizeEdit.......scroll down until you see a paste icon with the
number 12 on it. Drag to your Toolbar.

Or you could place event code in the target
worksheet that preserves the formatting when anything is copied into it.

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

This is sheet event code. Right-click on the target sheet tab and "View Code".

Copy/paste into that sheet module. Alt + q to return to the Excel sheet window.

You can now copy from source sheet and paste to target sheet with no disruption
of target sheet formatting.


Gord Dibben MS Excel MVP

On Wed, 2 Jan 2008 14:24:03 -0800, smccarvi
wrote:

I often am able to set up my excel tables in advance - Borders, bold or
italic cells, etc. and then later when the data is available I often am
copying and pasting values from other worksheets and formulas from with in my
own sheet. Unfortuntly when pasting I lose my formatting.

Is it possible to lock-in the formatting at some point before I begin
putting in data? It would save me a huge amount of time.





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
Enhancement Request: Give us ability to lock/freeze tabs in Excel Alyson Calhoun Excel Worksheet Functions 2 June 1st 06 05:36 PM
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
Freeze Formatting Shawn Excel Discussion (Misc queries) 1 January 10th 05 10:49 PM
How do I freeze or lock cells to show up on each page without typ. [email protected] Excel Discussion (Misc queries) 1 December 7th 04 05:22 AM


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