View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Run Time Error '1004'

When multiple sheets are selected, you'll see [Group] in the title bar. This
means that lots of things that lots of things you do to one sheet, you do to all
the sheets in the group.

But there are somethings that can't be done when the worksheets are
grouped--including changing protection.

You can ungroup sheets manually by just rightclicking on one of the worksheets
that are grouped (notice the background color of the worksheet tabs) and
selecting Ungroup Sheets.

In code, you can select a single sheet.

Private Sub Workbook_Open()
With Sheets("Olean - Wellsville")
.select
.EnableAutoFilter = True
.Protect contents:=True, userInterfaceOnly:=True
End With
End Sub



Carpie wrote:

A spreadsheet that is used by many different people is coming up with the
subject error now which is defined as an "Application-defined or
Object-Defined error". It gives me the chance to end or debug. When I
choose debug it takes me to code that states:

Private Sub Workbook_Open()
Sheets("Olean - Wellsville").EnableAutoFilter = True
Sheets("Olean - Wellsville").Protect contents:=True,
userInterfaceOnly:=True
End Sub

The third line is the one that it is highlighted in Yellow. I'm not versed
in VBA so I have no idea what seems to be the issue but am guessing that
somehow the syntax has been altered. Based on this limited information I
have provided, are you able to help?

I should also mention that when I open the file [Group] is appended to the
file name. I don't have any idea what that means.


--

Dave Peterson