Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Oct 2005
    Location
    Calgary, Alberta
    Posts
    205
    Thanks
    0
    Thanked 1 Time in 1 Post

    lock sheets macro (excel 2000)

    Hello,
    I have wrote a piece of code which will look specified worksheets or unlock them depending on the t / f condition on the toggle switch.

    Private Sub LockInput_Click()
    Dim oSheets As Object
    oSheets = Array("Input", "NGC Well Data")
    If LockInput.Value = True Then
    Sheets(oSheets).Unprotect
    LockInput.Caption = "UNLOCKED"
    Else
    Sheets(oSheets).Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
    LockInput.Caption = "LOCKED"
    End If
    End Sub

    this code is giving me an object error, can I only speicfy one sheet at a time for this function or is there another problem?

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: lock sheets macro (excel 2000)

    Yes, you need to do each sheet separately.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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