你可以在Excel中“合并”吗?

Excel中内置了“合并横向”function,可以突出显示范围,然后自动合并每行中的所有单元格,但不会合并行(主要用于报表)。 你可以在列上做同样的事情吗?

Excel本身不支持“合并”。 我为这个函数写了一个macros:

Sub MergeDown() Dim i As Integer, NumCols As Integer, NumRows As Integer, _ LocX As Integer, LocY As Integer LocX = Selection.Column LocY = Selection.Row NumCols = Selection.Columns.Count NumRows = Selection.Rows.Count For i = 1 To NumCols Range(Cells(LocY, LocX + i - 1), Cells(LocY + NumRows - 1, _ LocX + i - 1)).Select On Error GoTo ErrorHandler Selection.Merge Next Exit Sub ErrorHandler: Exit Sub End Sub 

PS:你真的不应该合并单元格,因为这使得工作表很困难。