Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I use a Macro to unprotect a sheet in the workbook?
I would like to have my macro, which is driven from sheet 1 of a
workbook, unprotect sheet 2 of the same workbook, then make changes to sheet 2 (which consist of simply hiding some rows depending on variables entered on sheet 1), and then reprotect sheet 2. I do not plan to password protect sheet 2, but I do not want someone to accidentally change a cell on sheet 2 before or after the macro has done its thing. Thanks to help from people on this group, the macro works on the sheet if it is unprotected. Now I am on the next stage. Thanks in advance for the help for this old timer, ex-fortran programmer - yep, that old... Bob Q. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I use a Macro to unprotect a sheet in the workbook?
Try this with the password "ron"
With Sheets("Sheet2") .Unprotect "ron" .Rows("10:15").EntireRow.Hidden = True .Protect "ron" End With -- Regards Ron de Bruin http://www.rondebruin.nl wrote in message oups.com... I would like to have my macro, which is driven from sheet 1 of a workbook, unprotect sheet 2 of the same workbook, then make changes to sheet 2 (which consist of simply hiding some rows depending on variables entered on sheet 1), and then reprotect sheet 2. I do not plan to password protect sheet 2, but I do not want someone to accidentally change a cell on sheet 2 before or after the macro has done its thing. Thanks to help from people on this group, the macro works on the sheet if it is unprotected. Now I am on the next stage. Thanks in advance for the help for this old timer, ex-fortran programmer - yep, that old... Bob Q. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I use a Macro to unprotect a sheet in the workbook?
activeworkbook.sheets(2).unprotect
conversely activeworkbook.sheets(2).protect to add a password activeworkbook.sheets(2).protect password:="password" activeworkbook.sheets(2).unprotect password:="password" -- When you lose your mind, you free your life. " wrote: I would like to have my macro, which is driven from sheet 1 of a workbook, unprotect sheet 2 of the same workbook, then make changes to sheet 2 (which consist of simply hiding some rows depending on variables entered on sheet 1), and then reprotect sheet 2. I do not plan to password protect sheet 2, but I do not want someone to accidentally change a cell on sheet 2 before or after the macro has done its thing. Thanks to help from people on this group, the macro works on the sheet if it is unprotected. Now I am on the next stage. Thanks in advance for the help for this old timer, ex-fortran programmer - yep, that old... Bob Q. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I use a Macro to unprotect a sheet in the workbook?
Bob,
This is relatively easy. Just record the protect and unprotect steps and edit the resulting code. You can either put these codes into separte macros and call them from sheet1, or incorpate them into the sheet1 code. -- steveB Remove "AYN" from email to respond wrote in message oups.com... I would like to have my macro, which is driven from sheet 1 of a workbook, unprotect sheet 2 of the same workbook, then make changes to sheet 2 (which consist of simply hiding some rows depending on variables entered on sheet 1), and then reprotect sheet 2. I do not plan to password protect sheet 2, but I do not want someone to accidentally change a cell on sheet 2 before or after the macro has done its thing. Thanks to help from people on this group, the macro works on the sheet if it is unprotected. Now I am on the next stage. Thanks in advance for the help for this old timer, ex-fortran programmer - yep, that old... Bob Q. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I use a Macro to unprotect a sheet in the workbook?
These tips all work. I have purchased three books and I am doing my
best to learn this language, but you folks are a lot better than any textbook I have found. Many thanks. Bob Q. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I use a Macro to unprotect a sheet in the workbook?
On Wed, 20 Jul 2005, Ron de Bruin wrote:
Try this with the password "ron" With Sheets("Sheet2") .Unprotect "ron" .Rows("10:15").EntireRow.Hidden = True .Protect "ron" End With You can also simplify it to: With Sheets("Sheet2") .Protect "ron", UserInterfaceOnly:=True .Rows("10:15").EntireRow.Hidden = True End With Don <www.donwiss.com (e-mail link at home page bottom). |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Forgotten Password to Unprotect Workbook/sheet | Excel Discussion (Misc queries) | |||
Unprotect sheet/workbook | New Users to Excel | |||
unprotect sheet & workbook dim out | Excel Worksheet Functions | |||
How to unprotect a workbook by macro? | Excel Discussion (Misc queries) | |||
Macro to unprotect workbook | Excel Programming |