|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub lkyy()
ar = Range("a1").CurrentRegion
ym = Replace(Split(ar(1, 1), "月")(0), "年", ".")
myl = UBound(ar, 2) - 2
ReDim br(1 To UBound(ar) * 4, 1 To myl)
myr = Range("b2").End(xlDown).Row
For i = 3 To myr
n = ar(i, 1)
For j = 2 To myl
br(n * 4 - 3, j - 1) = ar(2, j)
br(n * 4 - 2, j - 1) = ar(i, j)
Next
br(n * 4 - 3, myl) = "月份"
br(n * 4 - 2, myl) = ym
Next
Sheets("工资条").Activate
Cells.ClearContents
Range("a5:r20000").Borders.LineStyle = xlNone
For i = 2 To n
Rows("1:4").Copy Cells(i * 4 - 3, 1)
Next
Range("a1").Resize(n * 4, UBound(br, 2)) = br
End Sub
|
|