|
楼主 |
发表于 2016-4-30 23:49
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 lzqlaj 于 2016-4-30 23:52 编辑
Private Sub CommandButton1_Click()
..........
Sheets("分析表(三率)").Activate
p12 = Sheets("分析表(三率)").[b65536].End(xlUp).Row
For kmjg = 3 To p12
If Cells(kmjg, 1) = "科目" Then
kmjghs = kmjg - 2
Exit For
End If
Next kmjg
Range(Cells(2, 1), Cells(20 * ks + 1, bj + 3)).Copy
Cells(20 * ks + 3, 1).Select
Selection.PasteSpecial Paste:=xlPasteAll, Transpose:=True
For k = 1 To ks - 1
Range(Cells(20 * ks + 3, k * (bj + 3) + 1), Cells(20 * ks + 3 + (bj + 2), 20 * (k + 1))).Cut
Cells(20 * ks + 3 + k * (bj + 3), 1).Select
ActiveSheet.Paste
Next k
Rows("2:" & (20 * ks + 2)).Delete Shift:=xlUp
t1 = Timer
MsgBox ("用时" & Round((t1 - t), 2) & "秒")
Application.ScreenUpdating = True
End Sub
|
|