Welcome to the TechSpot OpenBoards. Please read the FAQ if you have any questions. Sign up or Login to participate.
|
|||||||
Begin your free trial now
Pay-as-you-go options starting at $10/user/month
Pay-as-you-go options starting at $10/user/month
Re-Protecting Excel Sheet via Macro
|
|
Thread Tools | Search this Thread |
|
#1
|
|||
|
|||
|
Re-Protecting Excel Sheet via Macro
Hello,
I have built a small, simple Macro in Excel which simply un-protects a sheet, copies and pastes some data from another sheet, and then re-protects the sheet. However, when I run the Macro, a prompt asking for a password to un-protect the sheet is asked, which is fine, then the copy and paste happens, however, I am not asked to enter a password to re-protect the sheet. When I exit the Macro, the sheet appears to be protected, however, simply selecting the un-protect sheet option, will un-protect it without prompting for a password. Is there something I'm missing? I wish to re-protect the sheet, where a password is required. Code: Sub Macro2() Sheets("Old").Select ActiveSheet.Unprotect Sheets("Totals").Select Range("A9:S400").Select Selection.Copy Sheets("Old").Select Range("A9").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True End Sub Any help would be gratefully received, thanks. |
![]() |
| Similar Topics | ||||
| Topic | Replies | Forum | ||
Excel macro writing
|
1 | Software Apps | ||
Excel 2003 SP3 font / new sheet error
|
2 | Windows OS | ||
Excel Help - Can you sort a column by using formula (not macro)
|
3 | Software Apps | ||
Missing number in excel sheet
|
8 | Windows OS | ||
Macro to name worksheet Tab in Excel?
|
1 | Software Apps | ||
| Thread Tools | Search this Thread |
|
|
All times are GMT -4. The time now is 04:07 AM.



Excel macro writing