Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello I have a workbook with several spreadsheets. I created a macro to
format a workshheet, e.g. copy and paste special values and protect the worksheet with a password then go to another worksheet and protect the worksheet with a password and return to the original worksheet. WHen I run the macro everything is fine except that when I unprotect the worksheet it does not ask me for a password but it unprotects the worksheets anyway I don't want anyone to be able to unprotect these worksheets without the password. Help and Thanks |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Without seeing the code it's hard to say what's going wrong but a sheet
password protected with code should ask for a password to un-protect it. Try this:- Sub protect() ActiveSheet.protect Password:="mypass" End Sub Mike "Wanna Learn" wrote: Hello I have a workbook with several spreadsheets. I created a macro to format a workshheet, e.g. copy and paste special values and protect the worksheet with a password then go to another worksheet and protect the worksheet with a password and return to the original worksheet. WHen I run the macro everything is fine except that when I unprotect the worksheet it does not ask me for a password but it unprotects the worksheets anyway I don't want anyone to be able to unprotect these worksheets without the password. Help and Thanks |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Mike
Below is my code at the end of the macro, it seems I do not have a password.... eventhough I had one when I recorded the macro)should I add your code after "active sheet" in both places ? Range("E2").Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowSorting _ :=True, AllowFiltering:=True Sheets("PG Report ").Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingCells:=True, AllowFormattingColumns:=True, _ AllowFormattingRows:=True Sheets("Discount Grid").Select Range("E2").Select "Mike H" wrote: Without seeing the code it's hard to say what's going wrong but a sheet password protected with code should ask for a password to un-protect it. Try this:- Sub protect() ActiveSheet.protect Password:="mypass" End Sub Mike "Wanna Learn" wrote: Hello I have a workbook with several spreadsheets. I created a macro to format a workshheet, e.g. copy and paste special values and protect the worksheet with a password then go to another worksheet and protect the worksheet with a password and return to the original worksheet. WHen I run the macro everything is fine except that when I unprotect the worksheet it does not ask me for a password but it unprotects the worksheets anyway I don't want anyone to be able to unprotect these worksheets without the password. Help and Thanks |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi
Delete the bits after activesheet.protect so the code looks more like Sub protect() Range("E2").Select ActiveSheet.protect Password:="mypass" Sheets("PG Report ").Select ActiveSheet.protect Password:="mypass" Sheets("Discount Grid").Select Range("E2").Select End Sub "Wanna Learn" wrote: Thanks Mike Below is my code at the end of the macro, it seems I do not have a password.... eventhough I had one when I recorded the macro)should I add your code after "active sheet" in both places ? Range("E2").Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowSorting _ :=True, AllowFiltering:=True Sheets("PG Report ").Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingCells:=True, AllowFormattingColumns:=True, _ AllowFormattingRows:=True Sheets("Discount Grid").Select Range("E2").Select "Mike H" wrote: Without seeing the code it's hard to say what's going wrong but a sheet password protected with code should ask for a password to un-protect it. Try this:- Sub protect() ActiveSheet.protect Password:="mypass" End Sub Mike "Wanna Learn" wrote: Hello I have a workbook with several spreadsheets. I created a macro to format a workshheet, e.g. copy and paste special values and protect the worksheet with a password then go to another worksheet and protect the worksheet with a password and return to the original worksheet. WHen I run the macro everything is fine except that when I unprotect the worksheet it does not ask me for a password but it unprotects the worksheets anyway I don't want anyone to be able to unprotect these worksheets without the password. Help and Thanks |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Mike PERFECT ! thanks a million
"Mike H" wrote: Hi Delete the bits after activesheet.protect so the code looks more like Sub protect() Range("E2").Select ActiveSheet.protect Password:="mypass" Sheets("PG Report ").Select ActiveSheet.protect Password:="mypass" Sheets("Discount Grid").Select Range("E2").Select End Sub "Wanna Learn" wrote: Thanks Mike Below is my code at the end of the macro, it seems I do not have a password.... eventhough I had one when I recorded the macro)should I add your code after "active sheet" in both places ? Range("E2").Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowSorting _ :=True, AllowFiltering:=True Sheets("PG Report ").Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingCells:=True, AllowFormattingColumns:=True, _ AllowFormattingRows:=True Sheets("Discount Grid").Select Range("E2").Select "Mike H" wrote: Without seeing the code it's hard to say what's going wrong but a sheet password protected with code should ask for a password to un-protect it. Try this:- Sub protect() ActiveSheet.protect Password:="mypass" End Sub Mike "Wanna Learn" wrote: Hello I have a workbook with several spreadsheets. I created a macro to format a workshheet, e.g. copy and paste special values and protect the worksheet with a password then go to another worksheet and protect the worksheet with a password and return to the original worksheet. WHen I run the macro everything is fine except that when I unprotect the worksheet it does not ask me for a password but it unprotects the worksheets anyway I don't want anyone to be able to unprotect these worksheets without the password. Help and Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Password for Running the Macro | Excel Discussion (Misc queries) | |||
Macro & Password | Excel Discussion (Misc queries) | |||
Password hyperlink or macro? | Excel Worksheet Functions | |||
How to see macro code of a password protected macro without a password? | Excel Worksheet Functions | |||
save as macro/for password | Excel Worksheet Functions |