View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Elkar Elkar is offline
external usenet poster
 
Posts: 964
Default Is there a way to prevent pasting data into an Excel worksheet

When you say that your code produces no effect, does that mean that you see
the message boxes or not? I tried your code and it produces a message box
every time a new cell is selected.

If you're getting nothing, then I'd check to see that you have Macros enabled.

TOOLS
MACRO
SECURITY
Set Security Level to Medium
Then close the workbook, and reopen.
Choose "Enable Macros"

Do you see results now?

HTH,
Elkar


"Rod from Corrections" wrote:

Elkar, thanks so much for trying to help me. It's nice to know that there
may be a solution to my problem. Unfortunately, when I tried what you
suggested, it had no effect - cut and paste was still allowed.

I know nothing about using Virtual Basic, but did a bit of research. I
tried the debug command and it reflected some syntax errors, which I then
tried to fix.

I ended up with the following in the VB Editor, but it still had no effect.
Can you help? Please be very explicit in your directions, since I am a
complete novice with VB. Thanks!

Private Sub Worksheet_Activate()
Select Case Application.CutCopyMode
Case Is = False
MsgBox "Not in Cut or Copy mode"
Case Is = xlCopy
MsgBox "In Copy mode"
Case Is = xlCut
MsgBox "In Cut mode"
End Select
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Excel.Range)
Select Case Application.CutCopyMode
Case Is = False
MsgBox "Not in Cut or Copy mode"
Case Is = xlCopy
MsgBox "In Copy mode"
Case Is = xlCut
MsgBox "In Cut mode"
End Select
End Sub