[英]VBA- Autofill from the old last row to new last row in the same column
我正在使用以下代碼在A列中找到最后一行,並在下一行中輸入新值。
Dim l As Long
l = Range("A" & Rows.Count).End(xlUp).Row + 1
ActiveSheet.Cells(l, "A").Value = "Your Value here"
但是之后,我需要一個代碼來找到相鄰列中的最后一行並自動填充直到最后一行。
有人可以幫我提供代碼嗎?
問候,卡爾西克
這是您的意思嗎?
LastRow1 =.Cells(Rows.Count, 1).End(xlUp).Row
Cells(lastRow1 + 1, 1).Value = "Your value here"
LastRow2 =.Cells(Rows.Count, 2).End(xlUp).Row
Range("A" & LastRow1 & ".AutoFill Destination:=Range("A" & LastRow1 & ":A" & LastRow2 & "), Type:=xlFillDefault
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.