首页 > 解决方案 > 公式拖拽查询

问题描述

我正在尝试使用以下代码将公式从一个范围拖到其下一个直接列

Range(Cells(11, lc2), Cells(70, lc2)).AutoFill _
Destination:=Range(Cells(11, lc2 + 1), Cells(70, lc2 + 1)), Type:=xlFillDefault

我面临 1004 错误

请指教

标签: vbaexcel

解决方案


您正在使用的列lc2, 必须包含在目标中,例如

Range(Cells(11, lc2), Cells(70, lc2)).AutoFill _
Destination:=Range(Cells(11, lc2), Cells(70, lc2 + 1)), Type:=xlFillDefault

这意味着您不能仅使用列自动填充lc2+1


推荐阅读