' 合并某一列中相同数据的单元格 Sub MergeColumns() Dim rowN As Integer Dim i, j, m, n As Integer Dim col As Integer col = 2 ' 合并哪一列的单元格 Application.DisplayAlerts = False rowN = Cells(65535, col).End(3).Row For i = 2 To rowN For j = i + 1 To rowN If Cells(j, col).Value <> Cells(i, col).Value Then m = i n = j - 1 Range(Cells(m, col), Cells(n, col)).Merge i = n Exit For End If Next j Next i MsgBox "完成!" End Sub