unprotect befuddlement

  • Thread starter Thread starter Kent Eilers
  • Start date Start date
K

Kent Eilers

Hi all:

I'm getting the following when I try to paste a range to another worksheet
in the same workbook:

? err.Description
PasteSpecial method of Range class failed
The cell or chart you are trying to change is protected and therefore
read-only.

I have run the unprotect after the error was triggered

wsTY.Unprotect

and still get the same error.....

This is the paste syntax I am using:

wsTY.Cells(iTargetRow, iTargetCol).PasteSpecial _
Paste:=xlFormats, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False

Why is the unprotect failing? This worked last week....there is something I
did that screwed this up and I can't figure out what....

Incidentally - the menu/tools/protection gives me both protect sheet and
unprotect workbook options and I can manually change cell values...

Thanks
 
If you see Tools|Protection|Protect Sheet, then your worksheet is already
unprotected.

If you see tools|protection|Unprotect Workbook, then your workbook is
protected. If your workbook is protected, but the sheet is unprotected, you can
still change change the values/formats.

Your code worked ok for me under light testing.

Any chanced taht itargetrow or itargetcell are messed up (not valid numbers)?

If you know that they're good, my next guess is that your code did something
that turned off the cutcopymode:

Try adding:

msgbox application.cutcopymode

right before your pastespecial line to make sure something still can be pasted.
 
Thanks Dave - I looked and discovered my code was out of synch and was
re-protecting the sheet just before theis routine was called !

ack !

))
 

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

Back
Top