Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2013
    Posts
    45

    Merge multiple vba sub procedures into one

    Hello All, would greatly appreciate some assistance with merging the following sub procderues into just one. Thanks!


    Private Sub Workbook_Open1()
    With Worksheets Sheet1
    .Unprotect Password:="password"
    .Protect Password:="password", UserInterfaceOnly:=True
    .EnableOutlining = True
    End With
    End Sub


    Private Sub Workbook_Open2()
    With Worksheets Sheet2
    .Unprotect Password:="password"
    .Protect Password:="password", UserInterfaceOnly:=True
    .EnableOutlining = True
    End With
    End Sub

  2. #2
    Join Date
    Jan 2013
    Posts
    45
    Nevermind, was able to figure out.

    Private Sub Workbook_Open
    With Worksheets Sheet1
    .Unprotect Password:="password"
    .Protect Password:="password", UserInterfaceOnly:=True
    .EnableOutlining = True
    End With
    With Worksheets Sheet2
    .Unprotect Password:="password"
    .Protect Password:="password", UserInterfaceOnly:=True
    .EnableOutlining = True
    End With
    End Sub

    Also dropped it into ThisWorkbook so it automatically runs upon open.

Posting Permissions

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