+ Reply to Thread
Results 1 to 7 of 7

Changing row height based on data length

  1. #1
    Forum Contributor
    Join Date
    03-13-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    152

    Changing row height based on data length

    Hi,

    Please see the attached file.

    I have text data in column A and numbers in column B. I have to format the file as follows

    column A width should be 45
    column B width should be 10
    Text in column A should be wrapped (wrap text)
    and some other formats

    I have macro to do all these requirements, but the problem is row height. It is bigger for some rows after running my macro (here rows 32 and 36). I want the row height to be 12.75 for row number 32. I have thousands of rows so I can't do it manually for each row. Could you please let me know how to adjust the row height globally based on data length without adjusting the current format?

    FYI - If I use the 'AutoFit Column/Row Width' it affects the column width, as per my requirement column width should be 45.

    Please help me.
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: Changing row height based on data length

    Does this do what you want?

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    03-13-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    152

    Re: Changing row height based on data length

    Awesome. Yes this is what I was looking for. Thank you so much Andy.
    However, I have made only one minor correction
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    As your code works perfectly only for the one or two line issues as per my attached document and it doesn't work 3 or more lines issues. Those issues are also gone after I updating the column width to 48.
    Thanks again.

  4. #4
    Forum Contributor
    Join Date
    03-13-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    152

    Re: Changing row height based on data length

    Hi Andy,

    The above code works fine but the problem comes back if I use filter option in column A. Please help me if you could do anything on this by changing your code.

    Thanks

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: Changing row height based on data length

    don't understand, why would filtering affect any row height?

    post example and explanation

  6. #6
    Forum Contributor
    Join Date
    03-13-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    152

    Re: Changing row height based on data length

    Andy,
    Please see the attached file (Row number 12). The problem is gone after running your macro, but it still exists if I reopen the file.
    Attached Files Attached Files

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: Changing row height based on data length

    Add the following to the Thisworkbook object so the code runs when the file opens.

    Please Login or Register  to view this content.

+ 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. Replies: 1
    Last Post: 06-13-2017, 01:16 PM
  2. Replies: 0
    Last Post: 02-13-2016, 03:31 AM
  3. Automating Row Height Based on the Length of Text
    By hvitzthum in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2013, 12:21 PM
  4. Changing bar color and height based on values
    By mcp3 in forum Excel General
    Replies: 0
    Last Post: 04-05-2012, 04:22 PM
  5. need to know how to control length and height of lines
    By LPN in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 08-02-2006, 07:10 PM
  6. [SOLVED] need to dbl row height without changing height of cell next to it
    By Excel-Illiterate in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-15-2006, 08:15 PM
  7. How I type SOLD across column length without changing current data
    By MommaRMe in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-19-2005, 05:07 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