我需要填寫公式,直到最后使用的行。我有來自 A6:A28 的資料,但是在使用下面的代碼時,它會將公式拖到第 628 行。問題在于代碼的第 4 行。請幫我改正。
Dim Lastrow As Long
Lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
ActiveSheet.Range("H6:M6").Select
Selection.AutoFill Destination:=Range("H6:M6" & Lastrow), Type:=xlFillDefault
uj5u.com熱心網友回復:
抄下公式
快速修復
- 只需洗掉
6.M
Selection.AutoFill Destination:=Range("H6:M" & LastRow), Type:=xlFillDefault
一種提升
- 不
Select - 無變數
- 不
AutoFill
With ActiveSheet ' improve!
With .Range("H6:M" & .Cells(.Rows.Count, "A").End(xlUp).Row)
.Formula = .Rows(1).Formula
End With
End With
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/480751.html
