clipboard breaks when range is protected?

R

RASelkirk

Hello,

I'm trying to copy some cells (using VBA) that are protected. Actually
the entire sheet with the exception of one column "Q" (for data entry
is protected. From the "Copy" button, here is my code:

Private Sub CommandCopy_Click()

ActiveWorkbook.Sheets("Codes").Unprotect (password)
Worksheets("Codes").Range("B2:N11").Select
Worksheets("Codes").Range("B2:N11").Copy
' ActiveWorkbook.Sheets("Codes").Protect (password)

End Sub

This works great if the last line (protect) is commented out. However
that leaves the sheet un-protected. If I uncomment the last line, th
clipboard somehow becomes erased. Is there any way to make this work?

Thanks!

Rus
 
G

Guest

hi,
try placing the protect line at the end of your code ie
after the pasteing and other work is done.
 
D

Dave Peterson

I don't use Corel, but maybe you can just:

Private Sub CommandCopy_Click()
Worksheets("Codes").Range("B2:N11").copy
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top