Sheet Protection

M

Mark Wolf

Hello,
I have a problem protecting a worksheets.
Basically there are several columns on this sheet where I enter date,
employee ID number and it gives me other info about this employee in
other columns retrieved from yet another sheet. The problem I have is
that this workbook is used by other people and they often accidentally
delete formulas I have in those other columns. So I wanted to protect
the sheet leaving only those columns where we type in, unprotected.
Everything works fine except that I also have VBA code which tells
excel to keep the format of the sheet (for print purpose) the same
when we update this sheet dally deleting some rows with Ctrl+D. So,
protection works fine but when I try to Ctrl+D to delete a row excel
won't let me. Is there any way to fix this problem?
Appreciate any help
Mark
 
G

Gord

This is usually overcome by using code to unprotect sheet, delete
chosen column(s) then re-protect.

Sub test()
With ActiveSheet
.Unprotect Password:="mypword"
Selection.EntireColumn.Delete
.Protect Password:="mypword"
End With
End Sub


Gord Dibben Microsoft Excel MVP
 
J

Jim Cone

If I understand you correctly:
You have VBA code to delete rows and format cells on a worksheet.
... the code is executed by pressing the Ctrl+D keys.
... the code doesn't run, instead you get an Excel message to unprotect the sheet.

To handle this issue, insert code at the start of the macro to unprotect the sheet and
at the end of the macro insert code to protect the sheet...
'---
Sub BreadcrumbWaggles
ActiveSheet.Unprotect Password:="mydogsname"
' your code here
ActiveSheet.Protect Password:="mydogsname"
End Sub
'---
Jim Cone
Portland, Oregon USA .
http://www.mediafire.com/PrimitiveSoftware .
(Data Rows Excel add-in: Color rows, Delete rows, Insert rows)




"Mark Wolf" <[email protected]>
wrote in message
news:[email protected]...
 

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