Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Paste special function

119 views
Skip to first unread message

richzip

unread,
Jan 1, 2008, 8:18:00 PM1/1/08
to
I have 2 worksheets: one large one with data for several employees, and a
smaller one that will be sent to individual employees. I have the smaller
worksheet formatted in an easy to read format, and will be copying data from
the larger worksheet to the smaller one.

When copying the data to the smaller worksheet, the formatting I customized
gets written over by the formatting from the larger worksheet. I know I can
use "paste special" to only copy the values and not the format. However, is
there a way to make this the "default" option for pasting so that I can use
"alt-V" instead of right clicking?

Jim Rech

unread,
Jan 2, 2008, 7:18:07 AM1/2/08
to
You should create a paste special values macro like this and assign a
keystroke to it (via Tools, Macro, Macros, pick macro, Properties).

Sub DoPasteValues()
ActiveCell.PasteSpecial xlValues
Application.CutCopyMode = False
End Sub


--
Jim
"richzip" <ric...@discussions.microsoft.com> wrote in message
news:E8EFE378-17A2-4132...@microsoft.com...

Gord Dibben

unread,
Jan 2, 2008, 5:59:54 PM1/2/08
to
As an alternative to Jim's suggestion 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

0 new messages