|
大概的意思就是 如果是2并且下面是合计就加16个空白行。如果是3就加15个空白行 。。。。写出来之后 单个可以运行 全部放在一起 就卡死了。。。。卡死了。。。。
Sub t2()
Dim x As Integer
Dim i1 As Integer
Dim i2 As Integer
Dim i3 As Integer
Dim i4 As Integer
Dim i5 As Integer
Dim i6 As Integer
Dim i7 As Integer
Dim i8 As Integer
Dim i9 As Integer
Dim i10 As Integer
Dim i11 As Integer
Dim i12 As Integer
Dim i13 As Integer
Dim i14 As Integer
Dim i15 As Integer
Dim i16 As Integer
Dim i17 As Integer
For x = 1 To 2000
For i1 = 1 To 500 Step 18
For i2 = 2 To 500 Step 18
For i3 = 3 To 500 Step 18
For i4 = 4 To 500 Step 18
For i5 = 5 To 500 Step 18
For i6 = 6 To 500 Step 18
For i7 = 7 To 500 Step 18
For i8 = 8 To 500 Step 18
For i9 = 9 To 500 Step 18
For i10 = 10 To 500 Step 18
For i11 = 11 To 500 Step 18
For i12 = 12 To 500 Step 18
For i13 = 13 To 500 Step 18
For i14 = 14 To 500 Step 18
For i15 = 15 To 500 Step 18
For i16 = 16 To 500 Step 18
For i17 = 17 To 500 Step 18
If Cells(x, 1) = i1 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 17)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i2 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 16)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i3 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 15)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i4 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 14)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i5 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 13)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i6 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 12)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i7 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 11)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i8 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 10)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i9 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 9)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i10 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 8)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i11 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 7)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i12 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 6)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i13 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 5)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i14 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 4)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i15 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 3)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i16 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 2)).Select
Selection.Insert Shift:=xlDown
ElseIf Cells(x, 1) = i17 And Cells(x + 1, 1) = "合计" Then
Rows((x + 1) & ":" & (x + 1)).Select
Selection.Insert Shift:=xlDown
End If
Next i17
Next i16
Next i15
Next i14
Next i13
Next i12
Next i11
Next i10
Next i9
Next i8
Next i7
Next i6
Next i5
Next i4
Next i3
Next i2
Next i1
Next x
End Sub
|
|