用VBA更改页Excel眉页脚中的日期格式
时间:2023-11-14 22:57:29
在Excel中通过自定义页脚的方式在页脚中插入日期时,Excel默认将使用短日期格式,如“2009-10-9”,但大家通常习惯使用“2009年10月9日”这样的长日期格式。Excel没有提供直接的方法在页眉或页脚中修改日期格式。在工作量不大的情况下,可以在页眉或页脚中手工输入这种长日期格式,但如果工作簿中的工作表数量较多,逐一手工输入显得很繁琐。用下面的VBA代码可以快速在所有工作表的页脚右边插入长日期格式的当前日期:
Sub FormatDateInFooter()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
ws.PageSetup.RightFooter = "更新日期:" & Format(Date, "yyyy年m月d日")
Next ws
End Sub
标签:工作,日期,格式,页眉,Excel函数
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
win10怎么更改系统字体?windows10更换全局字体方法教程
2022-02-14 20:09:16
![](https://img.aspxhome.com/file/2023/30/a266642_0s.jpg)
Excel PERCENTRANK.INC 函数 使用实例教程
2022-10-01 07:07:14
![](https://img.aspxhome.com/file/2023/2/a162912_0s.png)
word 如何将文档中的文本数据快速转换成表格?
2022-04-19 06:58:56
![](https://img.aspxhome.com/file/2023/9/35549_0s.png)
win7电脑收藏夹不能用如何解决?
2022-07-24 22:13:15
![](https://img.aspxhome.com/file/2023/3/a295319_0s.jpg)
excel怎样隐藏与显示状态栏
2022-11-21 10:19:48
Win7重装后鼠标键盘不能用怎么解决?
2023-07-01 23:23:40
![](https://img.aspxhome.com/file/2023/1/a276665_0s.png)
ppt橡皮擦在哪里
2023-11-10 04:21:28
![](https://img.aspxhome.com/file/2023/10/a351211_0s.jpg)
Mac新手需掌握的操作技巧——访达篇
2022-11-05 16:59:00
![](https://img.aspxhome.com/file/2023/5/a204475_0s.jpeg)
2022年1月最新CPU性能天梯图
2023-03-17 22:58:26
![](https://img.aspxhome.com/file/2023/6/a321674_0s.png)
在Word2007中以粘贴链接形式链接文件的方法步骤
2022-09-20 20:11:08
![](https://img.aspxhome.com/file/2023/9/30019_0s.jpg)
搜狗手机输入法怎么删除记忆词汇_搜狗输入法删除记忆词汇的操作方法
2022-01-31 21:39:58
![](https://img.aspxhome.com/file/2023/5/a317288_0s.jpg)
剪映专业版如何给视频添加数字动画
2022-04-20 02:10:27
![](https://img.aspxhome.com/file/2023/9/a341425_0s.png)
搜狗输入法美图聊聊怎么用?
2022-07-14 08:47:50
![](https://img.aspxhome.com/file/2023/5/a317584_0s.jpg)
软件不兼容是什么意思
2022-07-15 06:46:01
win10系统怎么关闭网络位置图文教程
2023-04-20 08:36:03
![](https://img.aspxhome.com/file/2023/4/a308868_0s.png)
word怎么让文字处于页面正中位置/上下左右居中?
2022-05-03 14:44:27
![](https://img.aspxhome.com/file/2023/1/35641_0s.png)
XP系统怎么设置远程桌面连接?
2022-05-06 07:34:35
![](https://img.aspxhome.com/file/2023/3/a302539_0s.jpg)
钉钉怎么设置并发布群公告
2022-09-10 13:53:04
![](https://img.aspxhome.com/file/2023/9/a341553_0s.png)
如何在Windows11上卸载适用于Android的Windows子系统(WSA)?
2022-01-18 07:59:22
![](https://img.aspxhome.com/file/2023/27/a236143_0s.png)
显卡驱动在电脑的什么位置?
2023-05-04 19:01:28
![](https://img.aspxhome.com/file/2023/6/a322640_0s.jpg)