Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default While doing multiple cell copy paste the Selection.PasteSpecial overrides the protected formula cells

I am using custom copy paste function in my Excel VBA. I trap the key
strokes for paste key and use Selection.PasteSpecial
Paste:=xlPasteValues, Operation:=xlPasteSpecialOperationNone,
SkipBlanks:=False, Transpose:=False function for copy paste. I have
some formula cells on my excel which are protected. If I try to paste
on these formula cells individually (single cell) it does not paste
anything since they are protected.But when I try to paste onto
multiple cells it over writes the values on to my formula cells there
by losing the formulas.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default While doing multiple cell copy paste the Selection.PasteSpecial ov

Let me rephrase this and see whether I'm understanding it right: You have a
macro already written which intercepts one of the paste key sequences -
<Ctl-V or <Shift-Ins, probably - and in the macro you use the
Selection.PasteSpecial method instead. When the Selection range is just one
cell, protection steps in and prevents the paste; but when multiple cells are
protected, formulae in protected cells are being overwritten. You want some
way of preventing that from happening. Is that right?

If so, I don't know much about protection - I hardly ever use it - so
someone else may be able to tell you something simpler. But if this is a bug
- I mean, a feature of Excel, then you should maybe write into your macro
something that refuses to do the paste if the Selection consists of more than
one cell, like this:

If Selection.Count = 1 Then
Selection.Paste ....
Else
MsgBox "Paste to multiple cells not allowed in this worksheet!", 16, _
"Not allowed!")
End If

If you want to get fancy, you can check all the cells in the Selection and
allow the paste only if none of them are protected.

--- "Sameet" wrote:
I am using custom copy paste function in my Excel VBA. I trap the key
strokes for paste key and use Selection.PasteSpecial
Paste:=xlPasteValues, Operation:=xlPasteSpecialOperationNone,
SkipBlanks:=False, Transpose:=False function for copy paste. I have
some formula cells on my excel which are protected. If I try to paste
on these formula cells individually (single cell) it does not paste
anything since they are protected.But when I try to paste onto
multiple cells it over writes the values on to my formula cells there
by losing the formulas.

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
.PasteSpecial Paste:=xlPasteFormulas / protected cells Werner Rohrmoser Excel Programming 0 April 2nd 08 12:59 PM
Exporting Logo from Access 97 to Excel 2000 by copy and pastespecial is stopping Cell A1 selection sid[_3_] Excel Programming 1 June 11th 07 11:01 AM
Copy paste a formula in multiple cells vijaya Excel Programming 1 November 3rd 05 08:33 PM
How to copy and paste same formula in multiple cells? Amanda Excel Worksheet Functions 1 June 30th 05 04:16 PM


All times are GMT +1. The time now is 10:57 AM.

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

About Us

"It's about Microsoft Excel"