Closed Thread
Results 1 to 3 of 3

Thread: Unprotect an excel sheet from inside a function

  1. #1
    Registered User
    Join Date
    05-17-2010
    Location
    kent, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Post Unprotect an excel sheet from inside a function

    I have a function that adds validation to a cell when a value is selected from a listbox in another cell.

    This works fine when the sheet is unprotected but for some reason it will not work when it is protected.

    I have added the unprotect sheet command to the code but it still wont work. When i do this in a Sub it works fine but doesnt work in a function.



    Function tester(range1, range2, range3)
    activesheet.unprotect
    If range1 = "2" Then

    range2.Validation.Delete
    range2.Validation.Add Type:=xlValidateList, _ Formula1:="=INDIRECT(""F1:F3"")"

    End If

    End Function


    Can someone help me out please?

    Thanks

  2. #2
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,777

    Re: Unprotect an excel sheet from inside a function

    Welocme to the forum, Typicalalex1.

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Moderator dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003 & 2007
    Posts
    3,714

    Smile Re: Unprotect an excel sheet from inside a function

    Cross posted.
    http://www.mrexcel.com/forum/showthread.php?t=468547

    Thread locked.

    DominicB

Closed Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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