Closed Thread
Results 1 to 19 of 19

Let dropdown list width expand beyond width of column so people can read answer choices?

  1. #1
    Registered User
    Join Date
    03-24-2016
    Location
    Washington, DC
    MS-Off Ver
    2010
    Posts
    41

    Let dropdown list width expand beyond width of column so people can read answer choices?

    I have a spreadsheet with a lot of data validation lists. Some of the response options are quite long and the text gets cut off because the column widths are narrow, and we want folks to be able to read the entire answer choice.

    We don't want to permanently expand the column widths because there are many columns and that would make it hard to navigate and read. I wrote some code to temporarily expand the whole column when a cell in that column is selected. That solved the width problem but the downside is that now it's impossible to "Undo", which is a pretty important function.

    The weird thing is in some instances, the drop down does expand beyond the column width when selected and sometimes it doesn't. I'm not sure why. Is there a way to allow just the dropdown to automatically expand according to response option text lengths, consistently?

    Thank you in advance!

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Hi X,

    You can probably adapt this code that I copied and adapted
    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Another link at that site has some other methods. http://www.contextures.com/xlDataVal08.html

  4. #4
    Registered User
    Join Date
    03-24-2016
    Location
    Washington, DC
    MS-Off Ver
    2010
    Posts
    41

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Thanks for the code, and the link! I tried using the code above, just swapping out the sheet names, but I got the error message "compile error: method or data member not found." I'm super new at this, and am not savvy enough to understand all of the statements to know if I need to swap out any other parameters in the code provided above. Any thoughts on this?

    I looked at the link, which is where I got the original code base for making the whole column temporarily wider, but this has the issue of resetting the page and making it impossible to ever hit "undo".

    Thanks!

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Why would you need undo? IF the user made the wrong selection, they would just need to redo their selection.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Hi X,

    The site prescribes that you manually insert a combobox and name it TempCombo - did you do that?

  7. #7
    Registered User
    Join Date
    03-24-2016
    Location
    Washington, DC
    MS-Off Ver
    2010
    Posts
    41

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Hi Kenneth, because the sheet contains lots of different types of data fields. The column width adjusting code makes it so that you can't undo ANYTHING in the sheet. If you accidentally delete a bunch of text or clear contents of a bunch of cells, you don't have the option to undo. =/

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window (or use the paperclip icon).

  9. #9
    Registered User
    Join Date
    03-24-2016
    Location
    Washington, DC
    MS-Off Ver
    2010
    Posts
    41

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Thanks, xl! I was trying to play around with what you mentioned above but haven't figured it out yet - I'm still working on it. We were using list data validation drop downs rather than developer controls so I hadn't used combo boxes before.

    There are a LOT of drop downs in the spreadsheet. Folks using the Excel file could potentially be doing so on Macs/PCs and various versions of Excel and crappy old computers, so we were hoping to have a file that would be as compatible and unlikely to crash/freeze as possible. (Not sure if that would factor into whether it would be OK to have lots of controls or not?)

  10. #10
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    In this example, one must reselect or change the selection if the cell is selected if you want to resize the column back to a prescribed default value. I have also attached the workbook as an example to play with.

    In your file, change the Range() in Intersect() to suit.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Hi X,

    Just the one combobox should handle them all as it refreshes each time you select a dropdown - it doesn't matter which one

  12. #12
    Registered User
    Join Date
    03-24-2016
    Location
    Washington, DC
    MS-Off Ver
    2010
    Posts
    41

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Thanks, both of you for putting so much effort into trying to help me!

    I attached a spreadsheet trying to explain what's going on, sticking with the list validation route (still playing with the other possible fixes). The "Working" sheet is doing what I want (kind of) - the drop down option width expands beyond the column itself automatically (still a bit too narrow though to read the whole option). The "Not working sheet" has columns and content copy/pasted from my actual document. It does not widen AT ALL. I have no idea why and how to control this. Even when I do minor things, like change the text content of a random cell in the table, it'll change the width of display for all drop down options in the sheet. It's really strange and seemingly unsystematic!

    Hope I'm making sense...

    ETA: I finally figured out what was up with the form controls and don't think that it's something we can implement in this document. Folks will be entering 1 observation per row, with a bunch of columns containing drop down menus. It won't be a single form-like interface (in this iteration, at least, maybe in the future!) populating into a database. =/
    Attached Files Attached Files
    Last edited by xdrenched; 03-31-2016 at 01:35 PM.

  13. #13
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Hi X,

    I made the width 10 times the Cell width, see the red.

    This is in your "Working" sheet module:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    03-24-2016
    Location
    Washington, DC
    MS-Off Ver
    2010
    Posts
    41

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    WHOA. Your solution is perfect! Thanks so much, x! I love that it works for any cell with data validation drop downs in it.

    I tried copy/pasting your code from the Working sheet to the Not Working sheet to see if it'd work but I'm getting the same "compile error: method or data member not found" message again when I click in any cell. The main difference I see in the code is that the last chunk of code in your sheet said "TempCombo" and "KeyUp" up top whereas in the copied code the last chunk says "(General)" and "TempCombo_KeyUp" but I'm not sure how to fix it since the drop downs don't allow those options from your code. I know earlier you talked about manually inserting a combo box and I tried learning about those (assuming that you're referring to: Developer>Insert>Form Controls>Combobox?), but if that's what you were talking about I don't see where you inserted it? Could you please walk me through what other steps you took other than putting in the code?

    Spreadsheet with my copypasta of your code into "Not working" and general messing around/testing is attached.

    Sorry for being such a n00b! o_O
    Attached Files Attached Files

  15. #15
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    It's "Developer>Insert>ActiveX Controls>Combobox" and then you go to properties (right click) and change the name to "TempCombo" - but i'm not sure you can use the same name in another sheet Isn't it a nice solution though?

    You could do it with another book Just save that one under a different name
    Last edited by xladept; 03-31-2016 at 03:17 PM.

  16. #16
    Registered User
    Join Date
    03-24-2016
    Location
    Washington, DC
    MS-Off Ver
    2010
    Posts
    41

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Ohhh I was totally looking at the wrong thing. That makes a lot more sense now. Thanks X! I got it to work with everything except our dependent drop downs (where each subsequent column =INDIRECT of the previous column - those are kinda tricky so I'm not terribly surprised). This is super useful!

  17. #17
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    You're welcome and thanks for the rep!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  18. #18
    Registered User
    Join Date
    11-14-2023
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    1

    Red face Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Quote Originally Posted by xladept View Post
    Hi X,

    I made the width 10 times the Cell width, see the red.

    This is in your "Working" sheet module:

    Please Login or Register  to view this content.
    Dear Xdrenched,

    Appreciating how old this post is, I hope it will reach you or other experts on this platform.

    I have benefited greatly from the solution you shared in this post. I tried it and it worked. However, I do have a follow up question and hope you might be able to shed some light on it as I am noob that do not fully understand what each set of these codes are supposed to do.

    What is working for me: being able to see the full texts in each option when I clicked on the drop-down list. This is working perfectly.

    What I am trying to fix: after I selected a response, the full text of my selection is shown in a separate text box besides the selected cell and is blocking all other cells. Is it possible to change the code so that once I selected a response, that is the end of it, I did not need to see the full text of what I selected in a separate text box.

    I hope that makes sense, if not, I am glad to attach picture of files as needed.

    Thank you so much for your help in advance!

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Let dropdown list width expand beyond width of column so people can read answer choice

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however you are not allowed to piggy-back another member's thread, so please open your own with a suitable title and, if you wish, a link back to this thread.

    Please see Forum Rule #1 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Reconciling units: Column width and image width
    By MarmaladeLover in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2015, 03:03 PM
  2. [SOLVED] Auto Expand or Contract Column Width as Data is Entered...
    By DeanExcel in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-13-2015, 07:10 AM
  3. Change width of a dropdown list
    By Masun in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-14-2014, 09:05 AM
  4. Replies: 2
    Last Post: 07-30-2014, 11:13 AM
  5. Replies: 2
    Last Post: 12-03-2013, 12:32 AM
  6. [SOLVED] Set Column Width Based On Total Width Of Other Columns
    By rayneraingoaway in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2006, 06:10 PM
  7. [SOLVED] set dropdown list width in validation
    By x taol in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2006, 12:10 AM

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