怎么在excel中用vba代码实现,在表格中随便选择一个区域,实现合并单元格?
1个回答
展开全部
Selection.Merge 直接合并
下面这个合并内容
Application.DisplayAlerts = False
Application.EnableEvents = False
For Each R In Selection
S = S & R.Text & S1
Next
Selection.Merge
Selection = IIf(S1 <> "", Mid(S, 1, Len(S) - 1), S)
Application.EnableEvents = True
Application.DisplayAlerts = True
下面这个合并内容
Application.DisplayAlerts = False
Application.EnableEvents = False
For Each R In Selection
S = S & R.Text & S1
Next
Selection.Merge
Selection = IIf(S1 <> "", Mid(S, 1, Len(S) - 1), S)
Application.EnableEvents = True
Application.DisplayAlerts = True
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询