Hi guys,
I have one big macro in my file which does a lot of things but I have one problem now.
I have recently added part which should go to different spreadsheet, unhide some sheets, copy data and paste to the previous file.
The issue I have is that I always get an error as the file with the data is protected with "Protect and share workbook" option. And as it is shared like that I can not unprotect workbook and unhide the sheets.
Is there a way for macro to
1. Remove the file from shared use (with password stored in the code).
2. Do all the other stuff (I can do it myself)
3. Share the file with tracking and protect with password stored in the code.
My code looks like that:
Thank you
I have one big macro in my file which does a lot of things but I have one problem now.
I have recently added part which should go to different spreadsheet, unhide some sheets, copy data and paste to the previous file.
The issue I have is that I always get an error as the file with the data is protected with "Protect and share workbook" option. And as it is shared like that I can not unprotect workbook and unhide the sheets.
Is there a way for macro to
1. Remove the file from shared use (with password stored in the code).
2. Do all the other stuff (I can do it myself)
3. Share the file with tracking and protect with password stored in the code.
My code looks like that:
Code:
' Cap 3
ActiveWorkbook.Unprotect "planning"
Windows("CAP 3.xlsm").Activate
Sheets("8 projects").Visible = True
Sheets("8 projects").Select
Range("A2:E49").Select
Selection.Copy
Windows("Reporting file - Central Product.xlsm").Activate
Range("A2:E49").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("CAP 3.xlsm").Activate
Sheets("8 projects").Visible = False
ActiveWorkbook.Protect "planning", Structure:=True, Windows:=False
Windows("Reporting file - Central Product.xlsm").Activate
Range("B2").Select
Thank you