excel空白单元格自动下下填充上一个单元格的值
适用情况
图片: [外链图片转存失败(img-PLzkQDdz-1566355138598)(])
vba代码
Sub test()
Set sh = ActiveSheet
i = 1
j = 1
num = 685
Text = sh.Cells(i, j)
'(i,j) i 代表行数 j代表需要填充的列数
'从第二行开始
For i = 2 To num
'i=m To n m,n分别代表需要填充的起始行数
If Trim(sh.Cells(i, j)) = "" Then
sh.Cells(i, j) = Text
Else
Text = sh.Cells(i, j)
End If
Next i
End Sub