+ Reply to Thread
Results 1 to 17 of 17

making dropdown list wider without making cell wider ???

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    371

    making dropdown list wider without making cell wider ???

    i have a spreadsheet that has a small cells with drop down list attached to it. the choices on the dropdown list are bigger than the cell but i have the cells either side to make up for the room. can i get the list wider without making the cell wider.


    i cant use Macro's because of my works limitations. please let me know if you need a sample and i will post it.

  2. #2
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: making dropdown list wider without making cell wider ???

    If you can't use macros, then you're stuck. Contextures.com has good materials for making the dropdown wider or larger, but they all involve VBA

    http://www.contextures.com/xlDataVal08.html#wider

  3. #3
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    371

    Re: making dropdown list wider without making cell wider ???

    i didnt think it could be done without macros... my work place doesnt allow them and because of this i have never bothered learning it.

  4. #4
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    371

    Re: making dropdown list wider without making cell wider ???

    ok. i have managed to talk my IT dept about letting me use macros.
    i have used the contexture website and used the code provided, i changed column 4 to read column 5 and it worked ok. but i need the same scipt for columns 5,9,13,17,21,25 and 29.

    as i dont now how to use macros at all, could someone please post the code needed.


    thanks

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
      If Target.Count > 1 Then Exit Sub
       If Target.Column = 5 Then
           Target.Columns.ColumnWidth = 20
       Else
           Columns(5).ColumnWidth = 1.43
       End If
       
    End Sub

  5. #5
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: making dropdown list wider without making cell wider ???

    maybe
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim defaultWidth As Double
    defaultWidth = 5
        If Target.Count > 1 Then Exit Sub
        Select Case Target.Column
        Case 5, 9, 13, 17, 21, 25
            Target.Columns.ColumnWidth = 20
        Case Else
            Columns(Target.Column).ColumnWidth = defaultWidth
        End Select
    End Sub
    Adjust default width to suit.
    Like a post? Click the star below it!

  6. #6
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    371

    Re: making dropdown list wider without making cell wider ???

    hi... the default width is 1.43 which i changed your code to as per request. i put the macro in and it worked ok on the cell selected (they opened bigger as expected), but didnt reduce down to 1.43 afterwards... on my code from contexture it stated to close column 5 back to 1.43 when the cell isnt selected anymore (well i think thats what it means) but on the code you posted it says "Columns(Target.Column)"... do i need to change this as well?????

  7. #7
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    371

    Re: making dropdown list wider without making cell wider ???

    i have relooked at this code. the cell grows as expected (Case 5, 9, 13, 17, 21, 25) but when i click a cell that isnt stated (Case 5, 9, 13, 17, 21, 25) afterwards, its this cells that shrinks to 1.43

  8. #8
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    371

    Re: making dropdown list wider without making cell wider ???

    please help

  9. #9
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: making dropdown list wider without making cell wider ???

    Sorry, I was offline for a few days.

    Try this variation:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim defaultWidth As Double
    defaultWidth = 5
        If Target.Count > 1 Then Exit Sub
        Select Case Target.Column
        Case 5, 9, 13, 17, 21, 25
            Target.Columns.ColumnWidth = 20
        Case Else
            Range("5:25").ColumnWidth = 1.43
        End Select
    End Sub
    When you select a cell in any column other than 5, 9, 13, 17, 21, and 25, these columns will revert back to the narrow size.

  10. #10
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    371

    Re: making dropdown list wider without making cell wider ???

    thanks but its still not want i need.. i dont want to change all the other cells sizes, just change back the one i selected in column 5, 9, 13, 17, 21, and 25.

    here is my project
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    371

    Re: making dropdown list wider without making cell wider ???

    as you can see on the off duty sheet on the columns 5, 9, 13, 17, 21, and 25 the reason why i only want those to change

  12. #12
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: making dropdown list wider without making cell wider ???

    Thanks for uploading a file. That really helps to understand what you want to achieve. Try this macro:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
        If Target.Count > 1 Then Exit Sub
        On Error Resume Next
        Application.ScreenUpdating = False
        Select Case Target.Column
        Case 5, 9, 13, 17, 21, 25, 29
            Target.Columns.ColumnWidth = 20
        Case Else
            Range("E:E").ColumnWidth = 1.43
            Range("I:I").ColumnWidth = 1.43
            Range("M:M").ColumnWidth = 1.43
            Range("Q:Q").ColumnWidth = 1.43
            Range("U:U").ColumnWidth = 1.43
            Range("Y:Y").ColumnWidth = 1.43
            Range("AC:AC").ColumnWidth = 1.43
            
        End Select
        Application.ScreenUpdating = True
    End Sub
    See attached file. Remember to save your file as a macro-enabled file with the XLSM extension.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    02-25-2016
    Location
    Detroit, MI
    MS-Off Ver
    Office 2013
    Posts
    1

    Re: making dropdown list wider without making cell wider ???

    Hi npamcpp, I wonder if you can help me?

    I am looking to use the above code to temporarily make my drop down list wider (maybe 7.0) and I want the columns to return to their original size of 0.40 even after I select something from the list.

    I only want it to apply to a table range from Col. BG thru Col. BTK and rows 6 thru 215. I do not want any other cells to resize in my workbook.

    Can you help me?

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,047

    Re: making dropdown list wider without making cell wider ???

    Quote Originally Posted by amanda0210 View Post
    Hi npamcpp, I wonder if you can help me?

    I am looking to use the above code to temporarily make my drop down list wider (maybe 7.0) and I want the columns to return to their original size of 0.40 even after I select something from the list.

    I only want it to apply to a table range from Col. BG thru Col. BTK and rows 6 thru 215. I do not want any other cells to resize in my workbook.

    Can you help me?
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 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
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  15. #15
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    371

    Re: making dropdown list wider without making cell wider ???

    cheers.. that looks exactly like i want

  16. #16
    Registered User
    Join Date
    09-26-2012
    Location
    Irrelevant
    MS-Off Ver
    Live 365
    Posts
    9

    Re: making dropdown list wider without making cell wider ???

    Started a new thread, as this one was marked "Solved", and you're probably not even reading this.
    Last edited by rjbinney; 02-19-2015 at 09:57 AM.

  17. #17
    Registered User
    Join Date
    01-17-2019
    Location
    MS
    MS-Off Ver
    2013
    Posts
    1

    Re: making dropdown list wider without making cell wider ???

    I know this thread has been dead for a number of years but it was exactly what I was looking for. My only question, is there a tweak that can be made so that the column only performs the above action (widening on click) when the user clicks the dropdown list cell to make their selection but does not perform the action if clicking in any of the cells below that dropdown cell? Thanks in advance.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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