如何利用VBA更改页Excel眉页脚中的日期格式
时间:2023-08-20 10:55:59
在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
标签:如何,利用,VBA,更改,页,Excel,眉,页脚,中的,日期
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
如何在PowerPoint幻灯片中进行音乐的循环播放
2023-08-04 02:40:11
is语音如何绑定手机号?is语音绑定手机号的操作步骤
2022-08-11 02:29:39
![](https://img.aspxhome.com/file/2023/7/a332743_0s.jpg)
imazing无法与服务器建立连接怎么办?
2022-04-24 22:22:33
![](https://img.aspxhome.com/file/2023/30/a267371_0s.jpg)
iOS14.1正式版已知BUG汇总
2023-11-30 13:45:07
![](https://img.aspxhome.com/file/2023/9/a194449_0s.jpg)
微信视频动态怎么发?视频动态发布方法简述
2023-04-19 22:24:03
![](https://img.aspxhome.com/file/2023/7/a331522_0s.jpg)
word2010表格背景颜色和底纹背景的方法
2023-06-16 12:37:31
excel表格如何加行
2022-08-09 01:50:05
win10黑屏无法进入桌面鼠标能动的解决方法
2022-08-31 10:51:38
![](https://img.aspxhome.com/file/2023/2/a285956_0s.jpg)
Win10企业版10240将于3月26日停止补丁更新
2022-10-04 12:07:10
![](https://img.aspxhome.com/file/2023/28/a242719_0s.jpg)
Win7系统摄像头打不开是怎么回事?Win7系统摄像头打不开解决办法
2022-11-12 17:08:35
![](https://img.aspxhome.com/file/2023/26/a228417_0s.png)
通透Windows 2008系统状态变化
2022-07-04 14:31:12
wps文字怎么调整页边距 wps文字页边距设置方法
2022-04-14 02:49:05
![](https://img.aspxhome.com/file/2023/8/a166268_0s.jpg)
WPS幻灯片实现循环播放的操作步骤
2023-09-10 22:41:48
如何设置word表格的边框和底纹效果
2023-06-03 02:44:49
![](https://img.aspxhome.com/file/2023/2/33012_0s.jpg)
wps文字怎样使用在线模板
2023-01-19 04:14:08
内置管理员无法打开天气怎么办?
2022-05-16 20:47:04
![](https://img.aspxhome.com/file/2023/30/a266178_0s.jpg)
三种创建excel数据透视表的方法介绍
2023-10-08 22:45:54
![](https://img.aspxhome.com/file/2023/8/41798_0s.jpg)
2021年u盘装系统工具排行榜
2022-03-06 10:42:24
如何运用Excel将整数转变为年月日形式
2023-12-05 11:51:54
![](https://img.aspxhome.com/file/2023/9/37719_0s.png)
如何解除Win7系统网络模式锁定
2023-07-17 10:31:27
![](https://img.aspxhome.com/file/2023/27/a233557_0s.jpg)