Resetting a Worksheet

EE Pros,

I have a macro that clears a number of cells through out a workbook.  Here's the slight dilemma.  If I fire the macro, and I have an outline collapsed on another worksheet, it will give me an error message.  For that reason, I need for the macro that clears the cells to "expand the outline" before it clears the results and thus works and won't give me the error on this line:  .Range("E:E") = "".  If I expand the OUTLINE to level 3, it will clear the Worksheet without a problem.  How do I add a line or two of code to auto expand the outline to level 3 before it tries to clear the cells?

Here is what the code looks like.

Sub ClearSelections()
'ActiveSheet.Unprotect Password:="password"
Dim I As Integer
    Application.EnableEvents = False
    Application.ScreenUpdating = False

   With Worksheets("Use_Cases")
   ActiveSheet.Unprotect Password:="password"

.Range("E:E") = ""
.Range("G800:G812") = ""
.Range("H7:H800") = ""
'.Range("r2") = 0
End With
    Application.ScreenUpdating = True
    Application.EnableEvents = True
.Protect Password:="jam"
End With
End Sub
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Create a macro while doing it manually and then include code like you see in the new macro.
Rodney EndrigaData AnalystCommented:
Try to insert this bit of code depending on how many levels you have in your Outline:

ActiveSheet.Outline.ShowLevels RowLevels:=1
ActiveSheet.Outline.ShowLevels RowLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=3

Insert these lines of code before you Clear the worksheet

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bright01Author Commented:
Thanks guys..... got it to work based on your comments.

Appreciate the help.

ML; "it's in the mail".

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.