|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Option Explicit
Sub TEST2()
Dim ar, br, cr, i&, j&, r&
Application.ScreenUpdating = False
ar = Sheets(1).[B1].CurrentRegion.Value
ReDim br(1 To UBound(ar) * UBound(ar, 2), 1 To 4)
cr = Split("日期 车牌号 项目 金额")
r = r + 1
For j = 0 To UBound(cr)
br(r, j + 1) = cr(j)
Next j
For j = 3 To UBound(ar, 2) - 1
For i = 2 To UBound(ar)
If Len(ar(i, j)) Then
r = r + 1
br(r, 1) = ar(i, 1)
br(r, 2) = ar(i, 2)
br(r, 3) = ar(1, j)
br(r, 4) = ar(i, j)
End If
Next i
Next j
Cells.Clear
With [B1].Resize(r, UBound(br, 2))
.Value = br
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Borders.LineStyle = xlContinuous
End With
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
1
查看全部评分
-
|