繁体   English   中英

运行时错误'1004'-VBA中对象'_Global'的方法'Range'失败

[英]Run-time error '1004' - Method 'Range' of object'_Global' failed in VBA

ActiveCell.FormulaR1C1 = "Y"
Range("B1").Select

Dim lastcellex As String

Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Select

lastcellex = ActiveCell.Address
Range("B1").Select
Selection.AutoFill Destination:=Range("B1:lastcellex")

谁能帮我解决为什么继续出现此错误? 我将变量设置为等于范围中的最后一个单元格,但超出了一列。 因此,如果列A中的范围是A55,lastcellex将是B55。 我正在尝试使其从B1:B55自动填充。

请让我知道你们的想法。

它应该是:

Selection.AutoFill Destination:=Range("B1:" & lastcellex)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM