简体   繁体   中英

VBA to fill formula down until last row in empty column

I have a report with a row count that changes daily. I need to autofill column C with a formula down to the last row of column B (columns A and B have different row counts, if that matters).

I have the formula in C2 (and a header in C1), how do I get vba to copy the formula in C2 down to the same row number as column B?

let C2 Autofill the column C until the last populated cell in column B :

With Sheets("Report")
  .Range("C2").AutoFill .Range("C2:C" & .Cells(.Rows.count, "B").End(xlUp).row)
End With

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM