我试图自动填充到一个变量,但我得到“范围类的自动填充方法失败”。Excel VBA - 范围类的自动填充方法失败
这里是有问题的代码:
Dim lastRow As Long
Dim lastRow2 As Long
lastRow = Range("A" & Rows.Count).End(xlUp).Row
lastRow2 = Range("U" & Rows.Count).End(xlUp).Row
'change where this is accordingly
'Delete columns
ActiveSheet.Range("C1,D1,F1,G1,H1,I1,L1,M1,R1,S1,V1,W1,Y1,Z1,AA1,AB1,AE1,AF1").EntireColumn.Delete
Columns("J:J").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("E10, T10").Value = "Full Name"
Range("E11").Formula = "=CONCATENATE(C11 , "" "" , D11)"
Range("E11").AutoFill Destination:="E11:" & lastRow 'THIS LINE THROWS THE ERROR
问题是什么吗?
' “E11:” &lastRow'你需要一个列?添加一个'E'?编辑:斯科特明显比我更好。 – findwindow
你缺少一个列引用:'Range(“E11”)。AutoFill Destination:=“E11:E”&lastRow'。你错过了第二个'E'。 –
我加了E但仍然抛出错误。 –