ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cells with varying number of lines (https://www.excelbanter.com/excel-programming/450486-cells-varying-number-lines.html)

gwc

Cells with varying number of lines
 
A1 contains one line.
B1 contains one line.
C1 contains one to many lines.
D1 contains two lines.
E1 contains one to many lines.
F1 contains one to many lines.

Now do I paste multiple lines into one cell?

How do I make all cells have the same height as the cell with the most lines?

How do I center vertically the contents in the cells that have less than the most lines?

isabelle

Cells with varying number of lines
 
hi,

here's one for example

Dim c As Range, txt As String
For Each c In Range("A1:F1")
txt = txt & c.Value & Chr(10)
Next
With Range("A2")
.Value = Left(txt, Len(txt) - 1)
.VerticalAlignment = xlCenter
.WrapText = True
.Rows.AutoFit
End With

isabelle

Le 2014-12-04 08:57, GWC a écrit :
A1 contains one line.
B1 contains one line.
C1 contains one to many lines.
D1 contains two lines.
E1 contains one to many lines.
F1 contains one to many lines.

Now do I paste multiple lines into one cell?

How do I make all cells have the same height as the cell with the most lines?

How do I center vertically the contents in the cells that have less than the most lines?



All times are GMT +1. The time now is 08:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com