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