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

Hi,

Is there a way of preventing users from Pasting into a worksheet? Can I
allow them to Paste values only?

thanks

Simon
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Prevent Paste

No
(1)you could protect the sheet or "critical" cells to prevent the user from
changing them
(2)you could use th esheet's CVhange event to convert formula to values and
to set any formatting to a default of your own.

here's an example. range name a table "MyTable"
Elsewhere create a region with randon numbers, then copy/paste so that the
pasted area overlaps into your table

Private Sub Worksheet_Change(ByVal Target As Range)
Dim overlap As Range
Set overlap = Intersect(Target, Range("MyTable"))
If Not overlap Is Nothing Then
' convert to values
overlap.Value = overlap.Value
'reset format
SetMyTableFormat
End If

End Sub

Private Sub SetMyTableFormat()
Application.EnableEvents = False
With Range("MyTable")
.Interior.ColorIndex = 34
.NumberFormat = "0.00"
End With
Application.EnableEvents = True
End Sub



"Simon Shaw" wrote:

Hi,

Is there a way of preventing users from Pasting into a worksheet? Can I
allow them to Paste values only?

thanks

Simon

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Prevent Paste

Hi Patrick,

Thanks, this is the type of solution I have done in the past...

I usually create a toolbar with a Paste Values button (among others), and
instruct users to click it when pasting, however, someone inevitably pastes
the 'normal' way and can make a mess of the sheet, not to mention, it ignors
the cell validation. I then have to put conditional formatting to ensure the
items in the list are valid.

Thanks

simon

"Patrick Molloy" wrote:

No
(1)you could protect the sheet or "critical" cells to prevent the user from
changing them
(2)you could use th esheet's CVhange event to convert formula to values and
to set any formatting to a default of your own.

here's an example. range name a table "MyTable"
Elsewhere create a region with randon numbers, then copy/paste so that the
pasted area overlaps into your table

Private Sub Worksheet_Change(ByVal Target As Range)
Dim overlap As Range
Set overlap = Intersect(Target, Range("MyTable"))
If Not overlap Is Nothing Then
' convert to values
overlap.Value = overlap.Value
'reset format
SetMyTableFormat
End If

End Sub

Private Sub SetMyTableFormat()
Application.EnableEvents = False
With Range("MyTable")
.Interior.ColorIndex = 34
.NumberFormat = "0.00"
End With
Application.EnableEvents = True
End Sub



"Simon Shaw" wrote:

Hi,

Is there a way of preventing users from Pasting into a worksheet? Can I
allow them to Paste values only?

thanks

Simon

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
Prevent cut & paste in a protected worksheet. JJ in LA[_2_] Excel Discussion (Misc queries) 0 April 5th 10 08:46 PM
Prevent Cut and Paste BadBoy Excel Worksheet Functions 3 February 18th 10 12:12 PM
Prevent cut and paste over a range andy62 Excel Worksheet Functions 0 June 30th 07 04:22 AM
How do I prevent certain Paste options soldier33w Excel Discussion (Misc queries) 1 February 8th 06 02:16 PM
prevent the copy and paste function sir Lancelot Excel Discussion (Misc queries) 1 December 8th 05 01:16 AM


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