Excel最近工作报表里用的编程代码
时间:2023-06-05 18:07:54
工作报表不能分享大家看,让可以让大家瞧瞧我这简单的代码,O(∩_∩)O哈哈~。具体如下:
Sub 清空销量2() ‘清空后6月导入的数据
res = MsgBox("准备清空销量数据", vbYesNo) ‘对话框的设置
If res = vbNo Then
Range("a3").Select ‘光标定位A2
Else
Range("a3:n25").ClearContents ‘清空该区域
MsgBox "已经清空销量数据"
Range("a3").Select
End If
End Sub
Sub 导入销量新数据2()
Sheets("外部后6月数据").Range("a3:n25").Copy Destination:=Range("a3:n25") ‘进行跨表数据的复制粘贴
MsgBox "成功导入销量数据"
End Sub
Sub 清空销额2() ‘同上
res = MsgBox("准备清空销售额数据", vbYesNo)
If res = vbNo Then
Range("a28").Select
Else
Range("a28:n51").ClearContents
MsgBox "已经清空销售额"
Range("a28").Select
End If
End Sub
Sub 导入销额新数据2()
Sheets("外部后6月数据").Range("a28:n51").Copy Destination:=Range("a28:n51")
MsgBox "成功导入销售额数据"
Range("a28").Select
End Sub
Sub 刷新全部透视表() ‘刷新工作簿的数据
ActiveWorkbook.RefreshAll
MsgBox "已经刷新工作簿中的全部透视表"
End Sub
总结:减少重复的人工操作,减少错误,运用几段简单的代码,效果跨工作表复制粘贴数据,刷新工作簿所有透视表,弹出是否对话框,清空数据。
本篇结束。
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
怎么用word制作商标
![](https://img.aspxhome.com/file/2023/7/34577_0s.gif)
Word怎么输入求和符号?Word输入求和符号的方法
![](https://img.aspxhome.com/file/2023/2/30882_0s.jpg)
Win11怎么设置滑动关机?Win11设置下拉关机教程
![](https://img.aspxhome.com/file/2023/27/a235858_0s.png)
集成显卡、核心显卡和独立显卡之间的区别
![](https://img.aspxhome.com/file/2023/3/a292378_0s.jpg)
WSA-with-Magisk-GApps-Pico 1.8.32822.0安装方法
![](https://img.aspxhome.com/file/2023/27/a237142_0s.png)
猎豹免费wifi连不上怎么处理?猎豹免费wifi连不上处理方法
![](https://img.aspxhome.com/file/2023/7/a332420_0s.jpg)
autodesk产品无法安装解决方案
巧将硬盘当U盘使用
![](https://img.aspxhome.com/file/2023/4/a304263_0s.jpg)
Win10笔记本外接显示器选仅第二屏幕出现卡顿掉帧如何解决?
![](https://img.aspxhome.com/file/2023/26/a223707_0s.jpg)
win7旗舰版电脑右键菜单中“打开方式”选项不见了
[视频]微软展示如何轻松移植iOS/Android应用到Win10上
![](https://img.aspxhome.com/file/2023/28/a250416_0s.jpg)
win10怎么进入安全模式?win10进入安全模式的方法
![](https://img.aspxhome.com/file/2023/28/a248877_0s.png)
wps表格设如何置字体颜色条件自动改变
IE浏览器打不开怎么办 IE浏览器无法运行的解决方法
![](https://img.aspxhome.com/file/2023/3/a300108_0s.jpg)
Excel怎么转换为Word格式?
![](https://img.aspxhome.com/file/2023/9/a153989_0s.png)
Win10网络共享怎么设置?Win10网络共享设置的方法步骤
![](https://img.aspxhome.com/file/2023/8/52298_0s.png)
Win10电脑怎么运行apk?Win10运行安卓软件的方法
![](https://img.aspxhome.com/file/2023/26/a225906_0s.jpg)
Win10系统打开软件一直提示用户账户控制弹窗的解决办法
![](https://img.aspxhome.com/file/2023/4/a303889_0s.jpg)
0xv00000e9错误怎么解决-0xv00000e9错误解决方法
![](https://img.aspxhome.com/file/2023/3/a301187_0s.jpg)
乐动力怎么开启亮屏计步 乐动力亮屏计步开启方法
![](https://img.aspxhome.com/file/2023/8/a339282_0s.jpg)