Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change zoom based on column width michalaw Excel Discussion (Misc queries) 2 August 11th 09 09:37 PM
Change Cell Width WITHOUT changing Column width dww701 Excel Discussion (Misc queries) 1 January 12th 09 10:52 PM
Change Line Width based on formula andy Charts and Charting in Excel 2 November 7th 07 04:53 PM
Need to write function that will change column width based on a condition dunlapww Excel Discussion (Misc queries) 2 February 28th 07 05:40 PM
hOW DO i CHANGE COLUMN WIDTH FOR ONLY A SELECT RANGE OF CELLS? RCONLON_291 Excel Discussion (Misc queries) 2 September 16th 05 11:24 AM


All times are GMT +1. The time now is 12:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"