VBA代碼:一鍵生成工資條和工資表
2023-07-08 22:47 作者:學(xué)術(shù)追夢人 | 我要投稿
代碼如下:
Sub gongzitiao()
Dim i As Integer
Dim n As Integer
n = Cells(Rows.Count, 1).End(xlUp).Row - 2
ActiveSheet.Rows("1:1").Select
For i = 1 To n '這里寫上
? ? Selection.Copy '復(fù)制第一行
? ??? ? ActiveCell.Offset(2, 0).EntireRow.Select
? ??? ? Selection.Insert shift:=xlDown
? ??Next i
End Sub
Sub gongzibiao()
Dim i As Integer
Dim n As Integer
n = Cells(Rows.Count, 1).End(xlUp).Row / 2 - 1
ActiveSheet.Rows("3:3").Select
For i = 1 To n
? ? Selection.Delete shift:=xlDown
? ? ActiveCell.Offset(1, 0).EntireRow.Select
Next i
End Sub