Sub yy() Dim i%, j%, k% k = Application.WorksheetFunction.CountIf(Columns(8), ">0") With Sheet2 For i = .[a65536].End(xlUp).Row To 9 Step -1 If IsDate(.Cells(i, 1)) Then .Rows(i).Delete Next i .Activate .Rows(9).ClearContents .Rows(9).Copy If k > 9 Then .Rows("10:" & 9 + k).Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Else .Rows("10:18").Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False End If End With j = 9 For i = 2 To [a65536].End(xlUp).Row If IsNumeric(Cells(i, 8)) Then With Sheet2 .Cells(j, 1) = Format(Cells(i, 9), "yyyy/m/d") .Cells(j, 2) = Cells(i, 2) .Cells(j, 7) = Cells(i, 8) j = j + 1 End With End If Next Sheet2.Cells(j, 2) = "以下空白" End Sub 这段代码能不能解释一下,谢谢!!! |