ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prevent certain cells from being copied (https://www.excelbanter.com/excel-programming/361253-prevent-certain-cells-being-copied.html)

morins[_2_]

Prevent certain cells from being copied
 

Does anyone have an idea on how to prevent a preselected cell in a
defined area from being copied (copy and paste) into another document
such as WORD?

For example: Ignore the content of cell B2 in the selected A1:C3
range.

Or maybe the way is to not be able to "highlight" the specific cell,
therfore blocking it from being copied.

Thanks for your help;

Stephane


--
morins
------------------------------------------------------------------------
morins's Profile: http://www.excelforum.com/member.php...o&userid=26522
View this thread: http://www.excelforum.com/showthread...hreadid=541315


Peter T

Prevent certain cells from being copied
 
Or maybe the way is to not be able to "highlight" the specific cell,
therfore blocking it from being copied.


You could try that. Start by unlocking all cells. Select the small square
that intersects row/column headers, Format / Protection. Now lock A1:C3 and
protect the Sheet (Tools Protection).

In your VBE (alt-F11) find your project, expand and select the worksheet
module. In properties (F4) change EnableSelection to 1- xlUnlockedCells.

Plenty of ways to circumvent though, eg copy the Worksheet elsewhere.

Regards,
Peter T

"morins" wrote in
message ...

Does anyone have an idea on how to prevent a preselected cell in a
defined area from being copied (copy and paste) into another document
such as WORD?

For example: Ignore the content of cell B2 in the selected A1:C3
range.

Or maybe the way is to not be able to "highlight" the specific cell,
therfore blocking it from being copied.

Thanks for your help;

Stephane


--
morins
------------------------------------------------------------------------
morins's Profile:

http://www.excelforum.com/member.php...o&userid=26522
View this thread: http://www.excelforum.com/showthread...hreadid=541315




morins[_3_]

Prevent certain cells from being copied
 

Thanks for the tip, Peter. Now I have to find a way to make sure that
when I change EnableSelection to 1- xlUnlockedCells it remains this way
after saving the file.


--
morins
------------------------------------------------------------------------
morins's Profile: http://www.excelforum.com/member.php...o&userid=26522
View this thread: http://www.excelforum.com/showthread...hreadid=541315


Peter T

Prevent certain cells from being copied
 
I always forget about that! Could reset in the Workbook open event though
would need to error trap in case sheet no longer exists or renamed (I
suppose not if the sheet is protected, codename perhaps).

Another thing you could do is in the Worksheet module

Private Sub Worksheet_Activate()
Me.EnableSelection = xlUnlockedCells
End Sub

This incidentally will solve the immediate problem I mentioned if the sheet
is copied elsewhere. There's probably more you can do, perhaps similar in
other events. But there's always going to be some way the user can copy your
data, eg with a simple vba routine.

Regards,
Peter T

"morins" wrote in
message ...

Thanks for the tip, Peter. Now I have to find a way to make sure that
when I change EnableSelection to 1- xlUnlockedCells it remains this way
after saving the file.


--
morins
------------------------------------------------------------------------
morins's Profile:

http://www.excelforum.com/member.php...o&userid=26522
View this thread: http://www.excelforum.com/showthread...hreadid=541315





All times are GMT +1. The time now is 09:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com