ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to unprotect target xls-sheet in VBA using advanced filter? (https://www.excelbanter.com/excel-programming/393799-how-unprotect-target-xls-sheet-vba-using-advanced-filter.html)

Kjetil

How to unprotect target xls-sheet in VBA using advanced filter?
 
Have a spreadsheet with advanced filter, that copies the result to another
sheet. Won't work with sheet-protection enabled. Anyone knows how to
unprotect the target sheet prior to the automated copying, and then
protecting the sheet again, to avoid user-error...?

other suggestions?

Mike H

How to unprotect target xls-sheet in VBA using advanced filter?
 
Maybe,

Sub protectmenot()
Worksheets("Sheet3").Unprotect Password:="mypass"
'do you stuff
Worksheets("Sheet3").Protect Password:="mypass"
End Sub

Mike

"Kjetil" wrote:

Have a spreadsheet with advanced filter, that copies the result to another
sheet. Won't work with sheet-protection enabled. Anyone knows how to
unprotect the target sheet prior to the automated copying, and then
protecting the sheet again, to avoid user-error...?

other suggestions?


Kjetil

How to unprotect target xls-sheet in VBA using advanced filter
 
Perfect! Thank a lot!

BR Kjetil

"Mike H" wrote:

Maybe,

Sub protectmenot()
Worksheets("Sheet3").Unprotect Password:="mypass"
'do you stuff
Worksheets("Sheet3").Protect Password:="mypass"
End Sub

Mike

"Kjetil" wrote:

Have a spreadsheet with advanced filter, that copies the result to another
sheet. Won't work with sheet-protection enabled. Anyone knows how to
unprotect the target sheet prior to the automated copying, and then
protecting the sheet again, to avoid user-error...?

other suggestions?



All times are GMT +1. The time now is 02:30 PM.

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