View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Zone[_3_] Zone[_3_] is offline
external usenet poster
 
Posts: 373
Default Restrict user's ability to paste into cells

Hi ewan. Sorry my solution didn't work for you. I thought you would have
the sheet protected, since sheet protection offers several options to
protect formatting. Maybe that's not feasible in your situation, since you
seem to want the users to be able to do some cutting and pasting but not
some. BTW, if my solution interferes with one of your procedures, you can
temporarily disable it like this:
application.enableevents=false
'do your stuff
application.enableevents=true
and of course you can temporarily disable sheet protection and re-enable it,
as well, James

"ewan7279" wrote in message
...
Hi Zone,

The code you provided now interferes with another piece of code I have to
update certain cells in the sheet unfortunately.

I think the solution must only lie in the paste property somehow...

I'll keep trying...

"ewan7279" wrote:

Hi Zone,

Thanks for this bit of code - it will stop the user from being able to
copy
and paste formulas into the sheet, or entering formulas of their own
within
the sheet.

However, I also want to stop them from pasting in cells that could change
the format of those in the sheet, as they currently contains conditional
formatting. With your solution, the user is still able to 'PasteAll',
damaging the existing formatting.

Any ideas how to get round this, or why the solution on the website I
pasted
into my original post worked for another user but not me?

Thanks.

"Zone" wrote:

If you want the user to only be able to enter values into the entire
worksheet, then this should work. Copy this code, right-click on the
sheet
tab, select View Code, and paste the code in there. HTH, James

Private Sub Worksheet_Change(ByVal Target As Range)
If Left(Target.Formula, 1) = "=" Then
Target.ClearContents
Target.Select
MsgBox "Please enter values only.", vbExclamation
End If
End Sub

"ewan7279" wrote in message
...
Hi All,

I would like to restrict what a user can paste into a cell - values
only.
I
found a response to another question
(http://p2p.wrox.com/topic.asp?TOPIC_...ame=topic.asp),
but it only works by changing the ctrl+v to a paste special macro
shortcut -
the rest of the code does not seem to work.

Any ideas please?