Hello everyone,
I have an excel sheet where I have some cells protected, unfortunately I can't merge/unmerge cells while the sheet is protected. So, I have written this VBA code
and this one
My question is, I choose certain settings when applying the protection (like, allowing the users to insert rows, format cells etc.), the problem is, when I run the macro, these settings are removed.
Is there away to fix this? Like to run the macro and merge/unmerge cells and still have the protection settings the same?
Thanks in advance.
I have an excel sheet where I have some cells protected, unfortunately I can't merge/unmerge cells while the sheet is protected. So, I have written this VBA code
VBA Code:
Sub MergeCells()
Application.ScreenUpdating = False
ActiveSheet.Unprotect "Password"
Selection.Merge
ActiveSheet.Protect "Password"
Application.ScreenUpdating = True
End Sub
VBA Code:
Sub UnMergeCells()
Application.ScreenUpdating = False
ActiveSheet.Unprotect "Password"
Selection.UnMerge
ActiveSheet.Protect "Password"
Application.ScreenUpdating = True
End Sub
My question is, I choose certain settings when applying the protection (like, allowing the users to insert rows, format cells etc.), the problem is, when I run the macro, these settings are removed.
Is there away to fix this? Like to run the macro and merge/unmerge cells and still have the protection settings the same?
Thanks in advance.