1
希望能够在下面的这段代码中获得帮助。它在模块1中工作,但不适用于任何工作表。我用我有限的知识尽力而为,但一直未能解决。代码在模块中工作,但不在工作表中错误1004
Sub lastrow()
Dim MCFPSheet As Worksheet
Set MCFPSheet = ThisWorkbook.Worksheets("MCFP Referrals YTD")
Dim lastrow As Long
lastrow = MCFPSheet.Range("I2").End(xlDown).Row
With MCFPSheet.Range("R8")
.AutoFill Destination:=Range("R8:R" & lastrow&)
End With
With MCFPSheet.Range("S2")
.AutoFill Destination:=Range("S2:S" & lastrow&)
End With
With MCFPSheet.Range("T2")
.AutoFill Destination:=Range("T2:T" & lastrow&)
End With
With MCFPSheet.Range("U2")
.AutoFill Destination:=Range("U2:U" & lastrow&)
End With
With MCFPSheet.Range("V2")
.AutoFill Destination:=Range("V2:V" & lastrow&)
End With
With MCFPSheet.Range("W2")
.AutoFill Destination:=Range("W2:W" & lastrow&)
End With
End Sub
我收到
错误1004
在.AutoFill Destination:=Range("R8:R" & lastrow&)
线。
由于您的自动填充目的地缺少图纸参考。所以用Destination:= MCFPSheet替换“Destination:=”。 – Sixthsense
啊,非常感谢! – Sky