Consulting

Results 1 to 5 of 5

Thread: Combobox vs protected sheets

  1. #1
    VBAX Regular
    Joined
    Apr 2009
    Posts
    36
    Location

    Combobox vs protected sheets

    Hi all,

    I'm currently struggling with that :

    I have sheets with a lot of comboboxes, their links cells are protected so that the user cannot change their name range etc.
    As the link cells are protected, I cannot change the value of the combobox...

    Who has a idea ?

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Select a linked cell, Format the cell and on the Protection tab there is a checkbox marked "Locked"; Un-check that box.

  3. #3
    VBAX Regular
    Joined
    Apr 2009
    Posts
    36
    Location
    In fact I want the link cell to be protected against manual input, not against combobox input

  4. #4
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    Well, you can either unlock the linked cell (Format Cells>Protection). So the rest of the sheet stays protected but the combobox is editable, or you can go to an ActiveX combobox (View>Toolbars>Control Toolbox) and use a programmatic solution:
    [vba]
    'Place this in the "ThisWorkbook" module:
    Private Sub Workbook_Open()
    Sheet1.ComboBox1.AddItem "Foo"
    Sheet1.ComboBox1.AddItem "Bar"
    Sheet1.ComboBox1.AddItem "Baz"
    End Sub
    [/vba][vba]
    'Place this in the Worksheet module that has the combobox:
    Private Sub ComboBox1_Change()
    Dim blnPrtMd As Boolean
    blnPrtMd = Me.ProtectionMode
    If blnPrtMd Then Me.Unprotect
    Me.Cells(1, 1).VALUE = Me.ComboBox1.ListIndex + 1&
    If blnPrtMd Then Me.Protect
    End Sub
    [/vba]
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

  5. #5
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Quote Originally Posted by Dabo
    In fact I want the link cell to be protected against manual input, not against combobox input
    Hide the row that the linked cell is on. When the sheet is protected the user can't unhide the row.

Posting Permissions

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