MrExcel Publishing
Your One Stop for Excel Tips & Solutions


Posted by Steve on August 30, 2000 9:11 AM

I developed an application that will be using PasteSpecial instead of Paste.
The code for the PasteSpecial Pastes values only. In this application there
are many locked cells with formulas and general information. When I use the
PasteSpecial command, it pastes the information right over locked cells without
checking to see if they are locked. I can check to see if the activecell is
locked. Is there any code that will check the entire paste area before pasteing
the data? I don't want to depend on user to select the entire paste area.

Posted by Celia on August 30, 0100 10:49 PM

I'm not too sure what you need but is the following any help?

Dim destRange As Range, cell As Range, lockedCells As String
If ActiveSheet.Protect = True Then
For Each cell In destRange
If cell.Locked = True Then lockedCells = lockedCells & " " & cell.Address(False, False)
MsgBox "The paste special destination range includes the following locked cells : " & lockedCells
End If