Disable Insert Column without protecting sheet.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Why I cannot protect the sheet:
The problem is that I have an autofilter across row 10. There are Private
Sub macros and the VBA code is password protected. So to run the macros I
put rectangles with the drawing toolbar and assigned macros so when the user
clicks the rectangle it runs the assigned macro which most of the macros
preform a funtion on the autofilter. When I protected the sheet I could
manually do the autofilter but it would error if I tried to run the macro by
clicking the rectangle box.

But I want to prevent Inserting or Deleting Columns in the workwheet.

Question: Is there a way to disable or prevent inserting or deleting
columns in a worksheet without protecting the sheet?

Thank you for your help.

Steven
 
Having an autofilter in place prevents inserting or deleting columns within
the filtered area. So extend you autofilter to include all the columns you
want protected.
 
Hi Steven,

Can you add code to your macros to unprotect the sheet to perform their
functions, then protect the sheet before they end. This would be as simple as
writing two subs, one to protect <WksProtect()>, and one to unprotect
<WksUnprotect()>. This gives you all the benefits of sheet protection and
your macros won't return an error.

To use, try something like this:

Sub MyMacro1()
' Performs some procedure yada, yada...

WksUnprotect
'procedure code here...
WksProtect

End Sub

Hope this helps!
GS
 
Back
Top