+ Reply to Thread
Results 1 to 3 of 3

Thread: Open workbook at a particular sheet

  1. #1
    George Gee
    Guest

    Open workbook at a particular sheet

    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



  2. #2
    Bob Phillips
    Guest

    Re: Open workbook at a particular sheet

    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
    >
    >




  3. #3
    George Gee
    Guest

    Re: Open workbook at a particular sheet

    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




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0