VBA向下填充公式,直到空列中的最后一行 [英] VBA to fill formula down until last row in empty column

查看:2003
本文介绍了VBA向下填充公式,直到空列中的最后一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个行计数每天变化的报告.我需要使用向下到B列最后一行的公式自动填充C列(如果重要的话,A列和B列的行数不同).

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).

我在C2中有公式(在C1中有标头),如何获取vba将C2中的公式复制到与B列相同的行号?

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?

推荐答案

C2 自动填充C直到列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

这篇关于VBA向下填充公式,直到空列中的最后一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆