|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%
- Dim arr, brr
- With Worksheets("原始数据")
- r = .UsedRange.Find(what:="*", LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByRows, searchdirection:=xlPrevious).Row
- c = .UsedRange.Find(what:="*", LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByColumns, searchdirection:=xlPrevious).Column
- arr = .Range("a4").Resize(r - 3, c)
- End With
- ReDim brr(1 To (UBound(arr) - 1) / 2, 1 To 34)
- m = 0
- For i = 2 To UBound(arr) Step 2
- m = m + 1
- brr(m, 1) = arr(i, 3)
- brr(m, 2) = arr(i, 11)
- brr(m, 3) = arr(i, 21)
- For j = 1 To UBound(arr, 2)
- n = arr(1, j) + 3
- If Len(arr(i + 1, j)) >= 10 Then
- brr(m, n) = Left(arr(i + 1, j), 5) & vbLf & Right(arr(i + 1, j), 5)
- End If
- Next
- Next
- With Worksheets("想要的效果")
- .UsedRange.Offset(1, 0).Clear
- With .Range("a2").Resize(UBound(brr), UBound(brr, 2))
- .Value = brr
- .Borders.LineStyle = xlContinuous
- With .Font
- .Name = "微软雅黑"
- .Size = 10
- End With
- End With
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|