我想选择动态单元格并自动填充到最后一行 [英] I want to select the dynamic cell and autofill it till the last row
本文介绍了我想选择动态单元格并自动填充到最后一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
该值在单元格 C 和 lastrow2 中并且想要自动填充到 lastrow3
the value is in cell C and lastrow2 and want to autofill till lastrow3
Range("C" & lastrow2).Select
Selection.AutoFill Destination:=Range(.Cells(lastrow2, 3), .Cells(lastrow3, 3)).FillDown
推荐答案
而不是 .Select
然后 Autofill
,您可以一次性填充整个范围.这是你正在尝试的吗?
Rather than .Select
and then Autofill
, you can populate the entire range in one go. Is this what you are trying?
ws.Range(ws.Cells(lastrow2, 3), ws.Cells(lastrow3, 3)).Formula = _
ws.Cells(lastrow2, 3).Formula
其中 ws
是您的相关工作表.例如
Where ws
is your relevant sheet. For example
Dim ws As Worksheet
Set ws = Sheet1
这篇关于我想选择动态单元格并自动填充到最后一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文