Narrowing Data Validation Dropdown List

  • Hi!


    I want to make some of my data validation dropdown lists narrower, so they end at the length of their longest list entry.


    I know NOTHING about VB and although I found some "free code" online that claims to do just what I want to do above, I have no idea how to paste it in or where to paste it in, etc.


    Can someone please tell me where to paste in this code. Like step-by-step, in layman's terms.


    Thanks!

  • Re: Narrowing Data Validation Dropdown List


    well that will depend on what type of code it is.


    If it is a standard sub, then go to Tools ------> Macro -------> Visual Basic Editor ------>Insert Module .......and paste the code.


    If the code is a worksheet change event of some kind, then right click on the tab of the worksheet that you want to place the code, choose View Code, and paste the code.

  • Re: Narrowing Data Validation Dropdown List


    If someone could just point me in the right direction of how to make the dropdown lists narrower that would be great...


    thanks!

  • Re: Narrowing Data Validation Dropdown List


    I don't know if it's right and I don't know where to paste it... I tried both ways you suggested and they didn't work.


    Basically, I have a bunch of columns where in each cell, you need to make a selection from a data validation pulldown list. I'm trying to make the pulldown lists narrower, preferably ending at the length of the longest text option in the pulldown. Does anyone know how to do this?

  • Re: Narrowing Data Validation Dropdown List


    I can't even find it at this point, I just pulled it off some random site yesterday. I'd rather know what to do and how to do it rather than just cutting and pasting some code.

  • Re: Narrowing Data Validation Dropdown List


    anyone? I know that other guy is not willing to help me any longer, but I'd like to know if:


    - there's a way to do this w/o using VB code


    - and if not, where specifcally to paste this code:


    http://www.freevbcode.com/ShowCode.Asp?ID=1800


    I can't figure it out - not familiar with VB and don't know where to paste the 'declarations' versus the 'code'.


    thanks!

  • Re: Narrowing Data Validation Dropdown List


    This is a satndard sub, follow these directions


    Tools ------> Macro -------> Visual Basic Editor ------>Insert Module .......and paste the code.

  • Re: Narrowing Data Validation Dropdown List


    all of it needs to be pasted into the same module. Here just copy this and palce it in your own module


  • Re: Narrowing Data Validation Dropdown List


    Thank you - I just did that - unfortunately - it didn't work! The dropdown boxes are still really wide.

  • Re: Narrowing Data Validation Dropdown List


    In design mode, double click your combo box and towards the bottom left of your screen, you will see a properties window. Find the property that says "AutoSize" and make the property true. This should help you out. Also, this is only true if the combo box that is being used is from the "Control Toolbox" not the "Forms" toolbox

  • Re: Narrowing Data Validation Dropdown List


    Ok I get that.. but I don't think my combo boxes are working. I had tried to make a combo box appear in each data validation pulldown cell by using this tutorial:


    http://www.contextures.com/xlDataVal10.html


    I followed this tutorial word for word, but when I try to test the code at the end by double-clicking on a data validation pulldown cell, no combo box appears. Not sure how to remedy this!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!