Excel 合并多项内容到首格

来源:互联网 发布:linux socket服务器 编辑:程序博客网 时间:2024/06/06 13:20

合并多个单元格内容到首格居中自动换行调整文字显示。

Sub 合并到首行()Application.ScreenUpdating = FalseApplication.DisplayAlerts = FalseDim i%'循环For i = 1 To Selection.CountStrTotal = StrTotal & Selection.Cells(i)Next'设置选区格式With Selection.MergeCells = True.HorizontalAlignment = xlCenter.VerticalAlignment = xlCenter.Value = StrTotal.AddIndent = False.MergeCells = False.WrapText = TrueEnd WithApplication.DisplayAlerts = TrueApplication.ScreenUpdating = TrueEnd Sub

其实相比于上一篇blog只改动了一条

.MergeCells = False
//是否合并单元格  = 否


阅读全文
0 0
原创粉丝点击