Macro with protected cells.

J

JD

I am using Office 2000 and have a table with about 20 columns & 64
rows. Data is inputted into 18 of the columns from time to time, the
other 2 columns being calculations based on the inputted data.

In order to prevent inputting from overriding the formulae, in error,
I want to protected the 2 calculated columns. However, I also want
to sort the table, by macro, using the calculated columns as the
sorting basis.

I can get a macro to work OK if there is no protection. Is there a
way to do what I want.

Thanks for any help.

JD
 
T

Tim Coddington

Perhaps ...
ActiveSheet.Unprotect
Columns("A:C").Sort Key1:=Range("C1")
ActiveSheet.Protect
???
 
P

Paul B

JD, you could have your macro unprotect the sheet do the sort and then
reprotect the sheet, or you could protect the sheet with userInterfaceOnly
like this
Worksheets("sheet1").Protect password:="test", userInterfaceOnly:=True

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
 
J

JD

Thanks, Paul. As I said to Tim, I can get it to work with a blank
password.
Regretfully, I don't understand your second solution. I don't see
that anywhere under Tools/Protection.

JD
 
P

Paul B

JD, use a macro somethinglike this for a password

Sub test1()
ActiveSheet.Unprotect password:="123"
'you code here
ActiveSheet.Protect password:="123"
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
 

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