excel表格怎么自动填充公式
时间:2023-07-21 05:02:01
excel表格中需要使公式计算,该怎么让表格自动填充输入公式呢?下面就跟小编一起看看吧。
excel表格自动填充公式的步骤
1、首先我们打开一个工作样表作为例子。
2、打开vba编辑窗口,创建一个新的模块,并输入以下代码:
Sub 填充公式()
Dim i As Long, j As Long
With Range("A1").CurrentRegion
i = .Rows.Count – 1
j = .Columns.Count – 1
End With
Range("J3").AutoFill _
Destination:=Range(Cells(3, 10), Cells(i, 10))
Range("D16").AutoFill _
Destination:=Range(Cells(16, 4), Cells(16, j))
End Sub
3、这里with是简化代码的写法,读取了当前活动单元格的区域,并将行列分别赋值为I和J变量-1。
4、简写掉的代码完整版的是Range("A1").CurrentRegion.Rows.Count和Range("A1").CurrentRegion.Columns.Count。就是这么简单和任性。
5、接着我们使用autofill函数来填充给定的单元格区域。其中,自动填充的公式单元格竖列指定的是J3,横行指定的是D13,代码如图。
6、而最终填充的区域范围,为本活动单元格的区域范围,我给的例子格式不正确,大家试试找出正确的公式和标题栏。我们创建一个宏按钮,来看一下正确运行的结果。
excel自动填充公式的
标签:公式,填充,的是,表格,Excel教程
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
excel表格内数据排序的方法
2022-09-24 10:15:48
苹果Mac OS X 10.10 Yosemite系统十大使用技巧汇总
2023-04-13 18:25:22
![](https://img.aspxhome.com/file/2023/4/a215444_0s.jpg)
Debian 6.0.5 系统安装图解教程
2023-03-16 18:18:14
![](https://img.aspxhome.com/file/2023/5/a319032_0s.jpg)
excel打印如何添加标题?内容一页打不下?—关于Excel文档打印的那些事
2023-04-29 12:35:44
![](https://img.aspxhome.com/file/2023/2/a140572_0s.jpg)
MAC下观看电影的三种方法
2022-10-27 17:37:42
![](https://img.aspxhome.com/file/2023/7/a216317_0s.jpg)
【MAC】照片图库分割!省空间又加快执行速度
2023-08-22 19:07:47
![](https://img.aspxhome.com/file/2023/7/a206717_0s.png)
在由文件创建选项卡中单击浏览按钮打开的浏览对话框
2022-06-15 11:45:28
怎么用钉钉新建番茄表单?钉钉新建番茄表单的方法
2022-09-25 06:11:55
![](https://img.aspxhome.com/file/2023/7/a329785_0s.jpg)
新MacBook Air:将包含15寸版本、搭载苹果M1升级版
2022-10-31 19:39:31
![](https://img.aspxhome.com/file/2023/3/a208603_0s.jpeg)
Windows Phone是最安全的移动系统 你信么
2023-10-12 12:24:17
![](https://img.aspxhome.com/file/2023/3/a300590_0s.jpg)
PPT中压缩图片大小的方法
2023-02-25 23:57:18
Word中设置奇偶页不同的页眉和页码的操作方法
2022-11-15 20:33:45
Mac之间传送帐号信息的技巧
2023-10-01 04:13:49
![](https://img.aspxhome.com/file/2023/8/a216248_0s.jpg)
QQ输入法怎么自定义词语?
2022-04-19 01:37:28
![](https://img.aspxhome.com/file/2023/5/a317434_0s.png)
跨表排名其实很简单,一个RANK函数就搞定了
2022-08-23 20:45:01
![](https://img.aspxhome.com/file/2023/5/a156995_0s.png)
Win10怎么关闭语音识别功能?Win10关闭语音识别功能的操作方法
2022-06-22 14:58:35
![](https://img.aspxhome.com/file/2023/8/52808_0s.png)
wps数字变成e+怎么解决?
2022-06-01 12:31:32
![](https://img.aspxhome.com/file/2023/9/a165739_0s.jpg)
打开EXCEL时无法找到startup.xls文件的解决方法
2022-07-21 06:23:47
![](https://img.aspxhome.com/file/2023/1/43251_0s.gif)
win10系统32位和64位的区别
2023-06-11 18:13:35
![](https://img.aspxhome.com/file/2023/4/a305477_0s.png)
用word如何制作真实的试卷模版?
2022-05-22 12:42:46
![](https://img.aspxhome.com/file/2023/6/29076_0s.jpg)