|
办公电脑有加密,附件不发了
工资条做到另一张表上
练手!
Sub 生成资条()
'
' https://club.excelhome.net/threa ... tml?_dsign=3e09058f
' 2024-6-12
Sheet2.Select
Columns("A:Y").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
'---
Sheet1.Select
x1 = 4
Do While Not (IsEmpty(Sheet1.Cells(x1, 2).Value))
x1 = x1 + 1
Loop
ygrs = x1 - 4
Range(Cells(2, 1), Cells(3, 24)).Select
Selection.Copy
Sheet2.Select
For i = 1 To ygrs * 4 Step 4
Cells(i, 1).Select
ActiveSheet.Paste
Next i
'---
x1 = 4
Do While Not (IsEmpty(Sheet1.Cells(x1, 2).Value))
For y = 1 To 23
Sheet2.Cells((x1 - 3) * 4 - 1, y).Value = Sheet1.Cells(x1, y).Value
Next y
Range(Cells((x1 - 3) * 4 - 1, 1), Cells((x1 - 3) * 4 - 1, 24)).Select
添加表格线
x1 = x1 + 1
Loop
End Sub
Sub 添加表格线()
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
End Sub
|
|