【问题标题】:I want to select the dynamic cell and autofill it till the last row我想选择动态单元格并自动填充到最后一行
【发布时间】:2021-08-10 02:14:24
【问题描述】:

值在单元格 C 和 lastrow2 中,并希望自动填充到 lastrow3

Range("C" & lastrow2).Select
Selection.AutoFill Destination:=Range(.Cells(lastrow2, 3), .Cells(lastrow3, 3)).FillDown

【问题讨论】:

  • 您为什么要在同一行中尝试AutoFillFillDownFillDownRange 上不合适,即AutoFillDestination 参数。

标签: excel vba autofill


【解决方案1】:

您可以一次性填充整个范围,而不是.Select 然后Autofill。这是你正在尝试的吗?

ws.Range(ws.Cells(lastrow2, 3), ws.Cells(lastrow3, 3)).Formula = _
ws.Cells(lastrow2, 3).Formula

ws 是您的相关工作表。例如

Dim ws As Worksheet
Set ws = Sheet1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-22
    • 1970-01-01
    • 1970-01-01
    • 2013-10-05
    • 2012-06-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-13
    相关资源
    最近更新 更多