|
- Private Sub CommandButton1_Click()
- Dim r, i
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Worksheets("客诉台账").Cells.Copy Worksheets("结果").Cells
- With Worksheets("结果")
- .Range("A1:j" & .[A65536].End(xlUp).Row).Sort key1:=.[G1], order1:=xlDescending
- r = .Range("A65536").End(xlUp).Row
- .Range("G2:G" & r).NumberFormatLocal = "G/通用格式"
- .Range("G2:G" & r).Value = .Range("G2:G" & r).Value
- For i = r To 2 Step -1
- If .Cells(i, 7).Value <> "" Then
- If .Cells(i, 7).Value = .Cells(i - 1, 7).Value Then
- .Range(.Cells(i - 1, 7), .Cells(i, 7)).Merge
- s = .Cells(i - 1, 10) & Chr(10) & .Cells(i, 10)
- .Range(.Cells(i - 1, 10), .Cells(i, 10)).Merge
- .Cells(i - 1, 10) = s
- End If
- End If
- Next
- End With
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- End Sub
复制代码
|
|