Disable Insert Column without protecting sheet.

S

Steven

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
 
T

Tom Ogilvy

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.
 
G

GS

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
 

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