+ Reply to Thread
Results 1 to 6 of 6

comboboxs in a userform handling a protected workbook and worksheets

  1. #1
    Registered User
    Join Date
    01-05-2014
    Location
    London, England
    MS-Off Ver
    Excel 20010
    Posts
    28

    comboboxs in a userform handling a protected workbook and worksheets

    I have created a userform1 with two dependant combo boxes, the worksheets and workbook is protected and I am struggling to place the unprotect function in the correct place. The purpose is to select from combo box one then select from combo box two; the value in combo box two is used by a command button on the user form to open the desired worksheet. Here lies the problem when everything is protected.
    Location is combo box one and sheet name is combo box two.

    The code functions without protection on.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: comboboxs in a userform handling a protected workbook and worksheets

    Could you attach a sample of the workbook with the userform and code you are using? I noticed that when the userform initializes, it unprotects the workbook. This could be why it's working because it has already been unprotected when the userform shows.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    01-05-2014
    Location
    London, England
    MS-Off Ver
    Excel 20010
    Posts
    28

    Re: comboboxs in a userform handling a protected workbook and worksheets

    The issue is relating to "hidden" and not password related. The code is fully functional for both protected and unprotected workbook and worksheets.
    The problem relates to [code] actWsh = ComboBox2.Text Worksheets(actWsh).Select [code] obviously the worksheet has to be unhidden for actWsh (active worksheet) to function.
    I believe I've uploaded a representative file. password = password
    Attached Files Attached Files

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: comboboxs in a userform handling a protected workbook and worksheets

    Hi there,

    See if the attached version of your workbook does what you need. It uses the following code:

    Please Login or Register  to view this content.

    Selecting a new sheet via the ComboBoxes automatically hides whichever "target" worksheet was selected previously.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-05-2014
    Location
    London, England
    MS-Off Ver
    Excel 20010
    Posts
    28

    Re: comboboxs in a userform handling a protected workbook and worksheets

    Remove the code ActWsh.Visible=xlsheetvisble and replace it with Worksheets(ActWsh).Visible=xlSheetVisible Fixed the code

  6. #6
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: comboboxs in a userform handling a protected workbook and worksheets

    Glad you were able to get it working.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Userform as printer interface for a protected workbook.
    By moosetales in forum Excel Programming / VBA / Macros
    Replies: 40
    Last Post: 04-27-2014, 08:43 PM
  2. populate comboboxs on userform
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-22-2013, 02:57 PM
  3. [SOLVED] Dependent Dynamic Lists for Userform Comboboxs
    By bharbir in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-22-2013, 01:58 AM
  4. [SOLVED] two userform comboboxs depend each other by value
    By hassan khansa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2013, 05:56 AM
  5. Userform with comboBoxs acting as filters
    By Rhamilton2512 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-13-2012, 05:49 PM
  6. Way to merge 3 userform comboboxs' data into a single cell, such as a date?
    By smaier69 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-22-2012, 09:47 PM
  7. [SOLVED] Group, Outline, Protected Worksheets and Protected Workbook
    By BEEJAY in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2006, 04:45 PM

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.6.0 RC 1