Share via

protect shape from editing

Anonymous
2014-02-04T07:16:06+00:00

I want to protect shape for my macro enable workbook

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2014-02-04T14:55:25+00:00

Hi,

try this code,

protect (from edit) only shapes in active sheet

Sub ProtectShapes_01()

With ActiveSheet

.Unprotect Password:="1230"

.Cells.Locked = False

End With

For Each s In ActiveSheet.Shapes

s.Locked = True

Next

ActiveSheet.Protect Password:="1230"

End Sub

XXXXXXXXXXXXXXX

also,

protect Shapes and specific cells

(in the sample below, protect 4 columns A:D)

Sub Protect_ShapesRange()

With ActiveSheet

.Unprotect Password:="1230"

.Cells.Locked = False

End With

For Each s In ActiveSheet.Shapes

s.Locked = True

Next

With ActiveSheet

.Range("A:D").Locked = True

.Protect Password:="1230"

End With

End Sub

Was this answer helpful?

0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2014-02-04T12:37:45+00:00

    when i try to print sheet then 'application defined or object defined error took place'

    when the sheet is protected some cells are not protected in LC sheet, please reply.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-02-04T09:40:58+00:00

    It will not make any difference whether your sheet is macro enabled or not. It should work.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2014-02-04T09:30:50+00:00

    Thanks, but tell if it is helpful in macro enabled sheet Here the link-

    http://sdrv.ms/LKuBil

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2014-02-04T07:49:38+00:00

    Protect your sheet. It will protect objects/shapes also.

    In case you don't want to protect cells, but only objects then select the whole sheet and go to format cells/protection/uncheck lock cells.

    Then protect the sheet. Now it will allow entry in cells but protect the objects/shapes.

    Hope it helps.

    Was this answer helpful?

    0 comments No comments