ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro with protected cells. (https://www.excelbanter.com/excel-programming/304368-macro-protected-cells.html)

JD

Macro with protected cells.
 
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



JD

Macro with protected cells.
 
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

"Paul B" wrote:

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[_6_]

Macro with protected cells.
 
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 **
"JD" wrote in message
...
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

"Paul B" wrote:

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






JD

Macro with protected cells.
 
Thanks again, Paul, I've got it working.
JD


"Paul B" wrote:

JD, use a macro somethinglike this for a password

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





All times are GMT +1. The time now is 12:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com