Hi all.
I have following code in a workbook, it protects all sheets,
and turns on autofilter. (Excel 200).
Private Sub Workbook_Open()
On Error Resume Next
Dim ws As Worksheet
'check for filter, turn on if none exists
For Each ws In ActiveWorkbook.Worksheets
With ws
If Not .AutoFilterMode Then
.Range("").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="", _
Contents:=True, UserInterfaceOnly:=True
End With
Next
End Sub
Can I add to this, to always open the workbook at a particular
worksheet, regardless of where it was last closed (saved)?
Any help with this code much appreciated.
Many thanks
George Gee
Private Sub Workbook_Open()
On Error Resume Next
Dim ws As Worksheet
'check for filter, turn on if none exists
For Each ws In ActiveWorkbook.Worksheets
With ws
If Not .AutoFilterMode Then
.Range("").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="", _
Contents:=True, UserInterfaceOnly:=True
End With
Next
Worksheets("Sheet1").Activate
End Sub
--
HTH
RP
(remove nothere from the email address if mailing direct)
"George Gee" <georgegee@nomaps.com> wrote in message
news:u5kvLJX0FHA.3256@TK2MSFTNGP09.phx.gbl...
> Hi all.
>
> I have following code in a workbook, it protects all sheets,
> and turns on autofilter. (Excel 200).
>
> Private Sub Workbook_Open()
> On Error Resume Next
> Dim ws As Worksheet
> 'check for filter, turn on if none exists
> For Each ws In ActiveWorkbook.Worksheets
> With ws
> If Not .AutoFilterMode Then
> .Range("").AutoFilter
> End If
> .EnableAutoFilter = True
> .Protect Password:="", _
> Contents:=True, UserInterfaceOnly:=True
> End With
> Next
> End Sub
>
>
> Can I add to this, to always open the workbook at a particular
> worksheet, regardless of where it was last closed (saved)?
> Any help with this code much appreciated.
>
> Many thanks
>
> George Gee
>
>
Many thanks Bob, that's perfect.
George Gee
Bob Phillips wrote:
> Private Sub Workbook_Open()
> On Error Resume Next
> Dim ws As Worksheet
> 'check for filter, turn on if none exists
> For Each ws In ActiveWorkbook.Worksheets
> With ws
> If Not .AutoFilterMode Then
> .Range("").AutoFilter
> End If
> .EnableAutoFilter = True
> .Protect Password:="", _
> Contents:=True, UserInterfaceOnly:=True
> End With
> Next
> Worksheets("Home").Activate
> End Sub
>
>
>
> "George Gee" <georgegee@nomaps.com> wrote in message
> news:u5kvLJX0FHA.3256@TK2MSFTNGP09.phx.gbl...
>> Hi all.
>>
>> I have following code in a workbook, it protects all sheets,
>> and turns on autofilter. (Excel 200).
>>
>> Private Sub Workbook_Open()
>> On Error Resume Next
>> Dim ws As Worksheet
>> 'check for filter, turn on if none exists
>> For Each ws In ActiveWorkbook.Worksheets
>> With ws
>> If Not .AutoFilterMode Then
>> .Range("").AutoFilter
>> End If
>> .EnableAutoFilter = True
>> .Protect Password:="", _
>> Contents:=True, UserInterfaceOnly:=True
>> End With
>> Next
>> End Sub
>>
>>
>> Can I add to this, to always open the workbook at a particular
>> worksheet, regardless of where it was last closed (saved)?
>> Any help with this code much appreciated.
>>
>> Many thanks
>>
>> George Gee
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks