+ Reply to Thread
Results 1 to 5 of 5

automatically extend columns while keeping a minimum width on specific columns

  1. #1
    Forum Contributor
    Join Date
    12-03-2009
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    184

    automatically extend columns while keeping a minimum width on specific columns

    I'm currently using the attached code to extend columns. I would like use to it only for specific columns and keep and minimum column width. Any help would be appreciated.


    HTML Code: 
    Thanks
    E.
    Last edited by enhydra; 09-16-2017 at 12:23 AM.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: automatically extend columns while keeping a minimum width on specific columns

    How are the specific columns arrived at?
    - predetermine (eg columns A,C, H auto fit, others minimum width)?
    OR
    - user asked to decide when values change?

    If you favour the former
    - which columns are to auto-fit?
    - should all the other columns be left unchanged?
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Forum Contributor
    Join Date
    12-03-2009
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: automatically extend columns while keeping a minimum width on specific columns

    Columns are preset and locked except for columns R through AB. I want columns R through AB to auto extend but not drop below a minimum of 7 width. Or at least that's what i'm trying for.

    Thanks

    E.

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: automatically extend columns while keeping a minimum width on specific columns

    These 2 lines should be all you need in your change macro
    Please Login or Register  to view this content.
    The active column should stretch if latest data is wider than previous widest data in that column.
    AutoFit tends not to work if the width of the column has already been changed from default to another specified width
    - so how about fixing the headers with some spaces to ensure required width does not fall below 7 or create a dummy row (row1?) in order to achieve this
    Merged cells cause problems for AutoFit - remove any merged cells

  5. #5
    Forum Contributor
    Join Date
    12-03-2009
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: automatically extend columns while keeping a minimum width on specific columns

    Thanks Kev, that's works great.

+ 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. Sort two columns (names) with keeping data intregity and order within the columns
    By ikindaknow in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-15-2015, 10:01 AM
  2. Programming to automatically send text to specific sheets and specific columns.
    By GlobalExcelller in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2014, 10:07 PM
  3. How do I automatically pull specific columns into a new workbook?
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-15-2014, 09:03 AM
  4. can i extend the existing 256 columns to 700 columns
    By catchnanan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-27-2013, 04:55 PM
  5. Macro to combine multiple columns keeping few columns specific
    By lramesh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-16-2013, 12:44 PM
  6. Replies: 8
    Last Post: 04-04-2013, 08:02 PM
  7. [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

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