PDA

View Full Version : Enable grouping and Ungrouping in Protected Sheet - VBA



Jaspal
06-28-2013, 03:44 AM
Hello there,

I have the following that protects my spreadsheet, but allows users to delete certain rows. I want the users to be able to group and ungroup certain columns that I have grouped already - so that it can be printed on A4. I
tweaked my code and added "EnableOutlining:=true", after "UserInterfaceOnly:=True, AllowDeletingRows:=True", but it does not work.

Thank you in advance,

Public Sub ProtectSheet(sWhichSheet)
' This Macro protects the Sheet
If Sheets(sWhichSheet).ProtectContents = False Then
Sheets(sWhichSheet).Protect Password:=sProtectionPassword, DrawingObjects:=True, Contents:=True, Scenarios:=True, UserInterfaceOnly:=True, AllowDeletingRows:= _
True
End If
End Sub

Teeroy
06-28-2013, 04:01 AM
Cross posted HERE. (http://www.mrexcel.com/forum/excel-questions/711286-enable-grouping-ungrouping-protected-sheet-visual-basic-applications.html)

Jaspal
06-28-2013, 04:16 AM
Teeroy, the Hyperlink in your response take me to mrExcel's question link that I posted.
Do you have an answer to my question?

Teeroy
06-28-2013, 04:54 AM
Jaspal, that was a message to other forum members. Multi-posting is frowned upon unless certain etiquette is used (see http://www.vbaexpress.com/forum/faq.php?faq=new_faq_item#faq_new_faq_item3). When cross posting it is polite to hyperlink to the original site so that any member who may work on the problem can check whether it has been solved elsewhere first.

Your problem description is a little vague. Can you attach a workbook with some dummy data to help define the problem?