+ Reply to Thread
Results 1 to 3 of 3

adjust column width based on empty cell within same column

  1. #1
    Registered User
    Join Date
    08-11-2010
    Location
    Stockholm
    MS-Off Ver
    Excel 2010
    Posts
    52

    adjust column width based on empty cell within same column

    Hej! Hope that all is good with you.

    I would like to adjust columns' widths based on if a cell is empty or not. Basically, if C2 is empty, then the column C width should automatically become 6 px. If any cell in row 2 is empty, those columns corresponding to those cells (D2 -> D, F2->F) should become 6px. However, the data is changing quickly, meaning that after I refresh the data, the columns can change and then they should all become the standard width of 25px unless these cells in row 2 are empty.

    Any suggestion on how to solve this would be very helpful

    ps: this same question is also posted here: https://www.mrexcel.com/board/thread...cells.1125032/

    Thank you!
    Vasco
    Last edited by vascobmcastro; 02-23-2020 at 02:52 PM.

  2. #2
    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,460

    Re: adjust column width based on empty cell within same column

    Administrative Note:

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)
    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.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: adjust column width based on empty cell within same column

    We need to identify a trigger event. You say the data is constantly changing and that you "refresh the data".

    I don;t know what you mean by refresh, but I'll assume for the moment that a worksheet Calculate event should be the trigger. In which case

    Please Login or Register  to view this content.
    Otherwise the same code in maybe a Sheet Change or Sheet Selection Change event
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ 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] Macro to adjust Column Width Based on Headings
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-25-2019, 10:46 PM
  2. Adjust cell contents on column width
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-27-2015, 03:34 AM
  3. [SOLVED] Adjust column width when specific cell value changes.
    By JO505 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2015, 03:14 PM
  4. Finding largest number in a column and adjust column width to fit
    By rob47uk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-01-2014, 07:12 PM
  5. [SOLVED] Automatically adjust column width to longest value in column
    By Grimace in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2013, 08:18 PM
  6. [SOLVED] how to adjust the width of a cell and not the entire column
    By gabrie ruz in forum Excel General
    Replies: 3
    Last Post: 08-03-2006, 01:00 PM
  7. [SOLVED] adjust column width
    By coolbeans in forum Excel General
    Replies: 1
    Last Post: 05-15-2005, 08:06 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