|
本帖最后由 ykcbf1100 于 2024-2-3 13:24 编辑
参与一下。。。- Sub ykcbf() '//2024.2.2
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- r = Me.Cells(Rows.Count, "r").End(3).Row
- arr = Me.Range("q1:ad" & r)
- ReDim brr(1 To 10000, 1 To 100)
- For i = 3 To UBound(arr)
- For j = 5 To 12
- If arr(i, j) <> Empty Then
- m = m + 1
- brr(m, 1) = arr(i, 1)
- brr(m, 2) = arr(i, 4)
- brr(m, 3) = Format(arr(i, 3), "yyyy年m月d日")
- brr(m, 4) = arr(2, j)
- brr(m, 9) = arr(i, j)
- brr(m, 11) = arr(i, 14)
- End If
- Next
- Next
- Me.Range("a3:o1000").UnMerge
- Me.Range("a3:o1000") = ""
- With Me.Range("a3").Resize(m, 15)
- .Value = brr
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- r = Me.Cells(Rows.Count, 1).End(3).Row
- Dim rng As Range
- c = 11 '//合并单元格列号
- For i = r To 3 Step -1
- Set rng = Me.Cells(i, c)
- Set Rng1 = rng.Offset(-1)
- If rng = Rng1 Then
- Me.Cells(i, c).Offset(-1).Resize(2).Merge
- End If
-
- Next
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|