Public Sub 提取()
Dim lr1%, lr2%, lc%, i%, j%
lr1 = Sheet1.Cells(65536, 1).End(xlUp).Row
For i = 1 To lr1
lc = Sheet1.Cells(i, 1000).End(xlToLeft).Column
lr2 = Sheet2.Cells(65536, 1).End(xlUp).Row
For j = 1 To lc
If i Mod 10 = 0 Then
Sheet2.Cells(lr2 + 1, j) = Sheet1.Cells(i, j)
End If
Next
Next
End Sub
添加一行辅助列,使满足条件的结果为0,然后数据透视,就能得出明细了
=INDEX(Sheet1!A:A,ROW(A1)*10)
右拉下拉
=OFFSET($A$1,ROW(A1)*10-1,COLUMN(A1)-1)