[英]VBA Macro to AutoFill multiple rows
我目前使用此代碼將公式自動填充到最后填充的列:
Dim lngLastColumn As Long
lngLastColumn = Cells.Find(What:="*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
Range(Activecell, Cells(Activecell.Row, lngLastColumn)).FillRight
但是一次只能工作一行。 有沒有辦法將其應用於我選擇的所有行?
謝謝,
托馬斯
您可以嘗試以下方法:
Dim lngLastColumn As Long
lngLastColumn = Cells.Find(What:="*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
Dim cell As Range
For Each cell In Selection.Columns(1).Cells
Range(cell, Cells(cell.Row, lngLastColumn)).FillRight
Next
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.