我试图每20行提取一个数字,并用它填充接下来的19个单元格。我当前的提取公式是=IF(MOD(CELL("row",A20),20)=0,AV21,"")
,我已经尝试过=IF(BJ21="",LOOKUP(1,1/($BJ$1:$BJ$10000<>""),$BJ$1:$BJ$10000),BJ21)
查找是否有值,但我无法从头开始。它到达底部并获取最后一个值。
这是它现在的外观和外观的图片:
答案 0 :(得分:0)
Option Explicit
Sub Fill_20()
Dim ws As Worksheet: Set ws = ThisWorkbook.Sheets("Test") '<-- Update
Dim i As Long, j As Long
Dim LR As Long, LC As Long
LR = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
LC = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column
For i = 1 To LR Step 20
ws.Range(ws.Cells(i, 1), ws.Cells(i + 19, LC)).Value = ws.Range(ws.Cells(i, 1), ws.Cells(i, LC)).Value
Next i
End Sub