ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MergeCell range (https://www.excelbanter.com/excel-programming/402875-mergecell-range.html)

Gus Chuch

MergeCell range
 
I got a form that Im using to put text in a cell (one word only), how can I
tell how many cells this word occupied (columns) so I can do a mergecell for
the number of cells? Im going to then set that to a MaxLen and if the next
word occupies more cells then the previous that will be my new MaxLen.

If MaxLen < NumberOfCell Then MaxLen = NumberOfCell

Range(Cells(Row , StartCol), Cells(Row ,(StartCol + Maxlen)).Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With

--
thank You
gus


All times are GMT +1. The time now is 03:17 AM.

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