Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Luc Luc is offline
external usenet poster
 
Posts: 23
Default Count number of characters in merged cells + adjusting rowheight

Lets say if the merged cell :
Contains more than 50 characters = double rowheight
More than 150 characters = triple rowheight
........

How do i do that?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Count number of characters in merged cells + adjusting rowheight

Sub ABCD()
i = Len(ActiveCell.Value)
h = ActiveCell.MergeArea.RowHeight
If i 150 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 3 * h
ElseIf i 50 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 2 * h
End If
End Sub

worked for me.

Don't run it twice on the same merged cells.

--
Regards,
Tom Ogilvy


"Luc" wrote:

Lets say if the merged cell :
Contains more than 50 characters = double rowheight
More than 150 characters = triple rowheight
........

How do i do that?



  #3   Report Post  
Posted to microsoft.public.excel.programming
Luc Luc is offline
external usenet poster
 
Posts: 23
Default Count number of characters in merged cells + adjusting rowheight

Thanks for your help !!!

What would the code look like if want to do the following :

I run a macro, which also fits the rowheight of the merged cells.
This macro has to check the rowheight of a range of merged cells (if length
75 then,....)

Example below


Range("FaseTekst").Select
For Each Row In Selection
i = Len(ActiveCell.Value)
h = ActiveCell.MergeArea.RowHeight
If i 150 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 3 * h
ElseIf i 75 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 2 * h
End If
Next Row

Sorry for the stupid mistakes i've made, i'm really a beginner !!
I think after each row has been fitted with the good height, the active cell
has to go 1 down.





"Tom Ogilvy" wrote in message
...
Sub ABCD()
i = Len(ActiveCell.Value)
h = ActiveCell.MergeArea.RowHeight
If i 150 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 3 * h
ElseIf i 50 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 2 * h
End If
End Sub

worked for me.

Don't run it twice on the same merged cells.

--
Regards,
Tom Ogilvy


"Luc" wrote:

Lets say if the merged cell :
Contains more than 50 characters = double rowheight
More than 150 characters = triple rowheight
........

How do i do that?





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Count number of characters in merged cells + adjusting rowheight

Sub ABCDEF()
Range("FaseTekst").Select
Do While Not Intersect(Range("FaseTekst"), ActiveCell) Is Nothing
i = Len(ActiveCell.Value)
h = ActiveCell.MergeArea.RowHeight
If i 150 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 3 * h
ElseIf i 75 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 2 * h
End If
ActiveCell.Offset(1, 0).Select
Loop

End Sub

worked fine for me in xl97, but I can't guarantee for every version, but I
would think it would work. Test it on a copy of your data.

--
Regards,
Tom Ogilvy


"Luc" wrote in message
t...
Thanks for your help !!!

What would the code look like if want to do the following :

I run a macro, which also fits the rowheight of the merged cells.
This macro has to check the rowheight of a range of merged cells (if

length
75 then,....)

Example below


Range("FaseTekst").Select
For Each Row In Selection
i = Len(ActiveCell.Value)
h = ActiveCell.MergeArea.RowHeight
If i 150 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 3 * h
ElseIf i 75 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 2 * h
End If
Next Row

Sorry for the stupid mistakes i've made, i'm really a beginner !!
I think after each row has been fitted with the good height, the active

cell
has to go 1 down.





"Tom Ogilvy" wrote in message
...
Sub ABCD()
i = Len(ActiveCell.Value)
h = ActiveCell.MergeArea.RowHeight
If i 150 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 3 * h
ElseIf i 50 Then
ActiveCell.MergeArea.EntireRow.RowHeight = 2 * h
End If
End Sub

worked for me.

Don't run it twice on the same merged cells.

--
Regards,
Tom Ogilvy


"Luc" wrote:

Lets say if the merged cell :
Contains more than 50 characters = double rowheight
More than 150 characters = triple rowheight
........

How do i do that?







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
Automatically Adjusting Row Height in Merged Cells MGC Excel Discussion (Misc queries) 12 October 1st 07 08:19 PM
Auto adjusting merged cells with wrap text on Sony Excel Discussion (Misc queries) 1 August 24th 06 04:15 PM
Max number if characters in a merged cell Dajana Excel Discussion (Misc queries) 1 September 7th 05 02:30 AM
Max number if characters in a merged cell Mike Excel Discussion (Misc queries) 0 September 7th 05 01:18 AM
Rows with merged cells are not adjusting even w/ Wrap Text and au. mkern20 Excel Discussion (Misc queries) 1 January 4th 05 08:10 PM


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

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

About Us

"It's about Microsoft Excel"