+ Reply to Thread
Results 1 to 3 of 3

change column width based on concatenated cells

  1. #1
    crimsonkng
    Guest

    change column width based on concatenated cells

    I concatenate up to 17 cells (Sheet1!B6 thru Sheet1!R6) into one large,
    merged cell (Sheet2!R96). I want my macro to change the width of the merged
    cell (Sheet2!R96) depending upon how much text is concatenated. The merged
    cell could have as little as 20 characters and as many as 60 characters of
    text. Is there a way for a macro to "count" the number of characters in a
    cell or, some other way, to determine the amount of text within that cell and
    then adjust the width of the cell accordingly?

  2. #2
    KCarhart
    Guest

    Re: change column width based on concatenated cells

    Hi crimsonkng

    You can say

    x = Len(ActiveCell.Value)
    ActiveCell.ColumnWidth = x

    And possibly work out a conversion factor (once) if 5 characters does
    not necessarily look the best in five width-units. You might want to
    multiply x by 1/2, 1/4 etc.


  3. #3
    crimsonkng
    Guest

    Re: change column width based on concatenated cells

    Awesome. I'll try it. Thanks.

    "KCarhart" wrote:

    > Hi crimsonkng
    >
    > You can say
    >
    > x = Len(ActiveCell.Value)
    > ActiveCell.ColumnWidth = x
    >
    > And possibly work out a conversion factor (once) if 5 characters does
    > not necessarily look the best in five width-units. You might want to
    > multiply x by 1/2, 1/4 etc.
    >
    >


+ 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