Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default how can i disable/enable "copy and past" in excel sheet?

Can you help me with VBA code? because i want t keep the formatting and
condition on cells as i did and disable the user to use copy and past from
another unformatted cell
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default how can i disable/enable "copy and past" in excel sheet?

Place this code in the worksheet module.

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
Application.CutCopyMode = False
End Sub

Note: will crash if cells are "cut" rather than copied.


Gord Dibben MS Excel MVP

On Sun, 17 Jan 2010 06:17:01 -0800, Aman
wrote:

Can you help me with VBA code? because i want t keep the formatting and
condition on cells as i did and disable the user to use copy and past from
another unformatted cell


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default how can i disable/enable "copy and past" in excel sheet?

I've done this by customizing the ribbon to remove that functionality

http://www.rondebruin.nl/ribbon.htm

I also added some code to catch the keyboard commands and have them do
something different

http://www.jkp-ads.com/Articles/CatchPaste.asp

It was kind of complicated to do it, but given some constraints I had, it
was what needed to be done.

--
HTH,

Barb Reinhardt



"Aman" wrote:

Can you help me with VBA code? because i want t keep the formatting and
condition on cells as i did and disable the user to use copy and past from
another unformatted cell

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 enable "Group" & "Ungroup" in a protected sheet DBLA137 Excel Discussion (Misc queries) 1 March 11th 09 12:20 AM
How do i disable/enable "Worksheet Move or copy" option? Saon Excel Worksheet Functions 1 May 15th 08 06:30 PM
Disable "Move or Copy sheet "action armaSANEA Excel Programming 1 August 15th 07 04:44 PM
Disable "Move or Copy sheet "action armaSANEA Excel Programming 0 August 14th 07 04:50 PM
How do i enable "Group" & "Ungroup" in a protected sheet ruddojo Excel Discussion (Misc queries) 0 June 2nd 06 01:01 AM


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