LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Macro doesn't work when Sheets are protected UserInterfaceOnly

I have a macro that deletes all conditonal formatting from several
worksheets. I set all worksheets protection UserInterfaceOnly:= True when
the workbook is opened. But when I run the macro below I get an Error:
Application-defined or object-defined error. If I unprotect the sheets it
works fine. I thought UserInterfaceOnly = True would allow all macros to
work. Anyone have any ideas?

Private Sub ClearDeptSchedules()

Dim wks As Worksheet
Dim lngLastRow As Long

For Each wks In colDepts
With wks
lngLastRow = .Cells(Rows.Count, "A").End(xlUp).Row
If lngLastRow = 5 Then
.Rows("5:" & lngLastRow).Delete Shift:=xlUp
End If
ERROR .Cells.FormatConditions.Delete
.Range("H1") = Now
End With
Next wks

End Sub


Cheers,
Ryan
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro doesn't work on UserInterfaceOnly-protected sheet Kasama Excel Programming 8 August 8th 06 10:17 AM
If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct? Marc Excel Programming 2 July 12th 06 04:10 AM
Strange problems with setting hidden property of a range when sheet protected with UserInterfaceOnly [email protected] Excel Programming 2 June 6th 06 04:15 PM
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? StargateFanFromWork[_3_] Excel Programming 6 January 26th 06 06:31 PM
validation lists and protected work sheets Tom Ogilvy Excel Programming 0 September 12th 03 01:01 PM


All times are GMT +1. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"