让我们一起探索一下这些藏在excel自动排序中的“小秘密”。-英雄云拓展知识分享
465
2024-02-10
如何在Excel中创建每个月/每一年的日曆?
在某些时候,您需要在Excel中创建特定的月份或年份日曆,如何快捷解决呢? 本教程介绍了在Excel中快捷创建月度或年度日曆的技能。
经过Excel模板创建每个月或每一年的日曆
经过VBA创建月曆
经过万年曆轻鬆创建月度或年度日曆
惊人的! 在 Excel 中使用高效率的选项卡,如 Chrome、Edge、Firefox 和 Safari!
每天节省50%的时间,并减少数千次鼠标单击!
在Excel中,您可使用日曆模板来创建每个月或每一年的日曆。
1.在Excel 2010/2013中,单击 文件 > 崭新,在Excel 2007中,单击 办公按钮 > 崭新,然后在弹出窗口的右边部份中输入 日曆 进入搜索引擎。 看截图:
在Excel 2010/2013中
在Excel 2007中
2。 按 Enter,然后窗口中会列出多种日曆。 选择所需的一种日曆,然后单击 下载(或创建) 在右窗格中。 看截图:
现在,在新工作簿中创建了一个日曆。 看截图:
有时,您需要为指定的月份创建一个月的日曆,例如2015年XNUMX月。使用上述方法很难找到这样的日曆模板。 在这里,我介绍了VBA代码,以帮助您创建特定的每个月日曆。
1。 按 Alt + F11键 打开钥匙 Microsoft Visual Basic for Applications 窗口中,单击 插入 > 模块,然后将以下VBA代码复制并粘贴到窗口中。
VBA:创建每个月日曆。
Sub CalendarMaker()' Unprotect sheet if had previous calendar to prevent error.
ActiveSheet.Protect DrawingObjects:=False, Contents:=False, _
Scenarios:=False
' Prevent screen flashing while drawing calendar.
Application.ScreenUpdating = False
' Set up error trapping.
On Error GoTo MyErrorTrap
' Clear area a1:g14 including any previous calendar.
Range("a1:g14").Clear
' Use InputBox to get desired month and year and set variable
' MyInput.
MyInput = InputBox("Type in Month and year for Calendar ")
' Allow user to end macro with Cancel in InputBox.
If MyInput = "" Then Exit Sub
' Get the date value of the beginning of inputted month.
StartDay = DateValue(MyInput)
' Check if valid date but not the first of the month
' -- if so, reset StartDay to first day of month.
If Day(StartDay) <> 1 Then
StartDay = DateValue(Month(StartDay) & "/1/" & _
Year(StartDay))
End If
' Prepare cell for Month and Year as fully spelled out.
Range("a1").NumberFormat = "mmmm yyyy"
' Center the Month and Year label across a1:g1 with appropriate
' size, height and bolding.
With Range("a1:g1")
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlCenter
.Font.Size = 18
.Font.Bold = True
.RowHeight = 35
End With
' Prepare a2:g2 for day of week labels with centering, size,
' height and bolding.
With Range("a2:g2")
.ColumnWidth = 11
.VerticalAlignment = xlCenter
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Orientation = xlHorizontal
.Font.Size = 12
.Font.Bold = True
.RowHeight = 20
End With
' Put days of week in a2:g2.
Range("a2") = "Sunday"
Range("b2") = "Monday"
Range("c2") = "Tuesday"
Range("d2") = "Wednesday"
Range("e2") = "Thursday"
Range("f2") = "Friday"
Range("g2") = "Saturday"
' Prepare a3:g7 for dates with left/top alignment, size, height
' and bolding.
With Range("a3:g8")
.HorizontalAlignment = xlRight
.VerticalAlignment = xlTop
.Font.Size = 18
.Font.Bold = True
.RowHeight = 21
End With
' Put inputted month and year fully spelling out into "a1".
Range("a1").Value = Application.Text(MyInput, "mmmm yyyy")
' Set variable and get which day of the week the month starts.
DayofWeek = WeekDay(StartDay)
' Set variables to identify the year and month as separate
' variables.
CurYear = Year(StartDay)
CurMonth = Month(StartDay)
' Set variable and calculate the first day of the next month.
FinalDay = DateSerial(CurYear, CurMonth + 1, 1)
' Place a "1" in cell position of the first day of the chosen
' month based on DayofWeek.
Select Case DayofWeek
Case 1
Range("a3").Value = 1
Case 2
Range("b3").Value = 1
Case 3
Range("c3").Value = 1
Case 4
Range("d3").Value = 1
Case 5
Range("e3").Value = 1
Case 6
Range("f3").Value = 1
Case 7
Range("g3").Value = 1
End Select
' Loop through range a3:g8 incrementing each cell after the "1"
' cell.
For Each cell In Range("a3:g8")
RowCell = cell.Row
ColCell = cell.Column
' Do if "1" is in first column.
If cell.Column = 1 And cell.Row = 3 Then
' Do if current cell is not in 1st column.
ElseIf cell.Column <> 1 Then
If cell.Offset(0, ⑴).Value >= 1 Then
cell.Value = cell.Offset(0, ⑴).Value + 1
' Stop when the last day of the month has been
' entered.
If cell.Value > (FinalDay - StartDay) Then
cell.Value = ""
' Exit loop when calendar has correct number of
' days shown.
Exit For
End If
End If
' Do only if current cell is not in Row 3 and is in Column 1.
ElseIf cell.Row > 3 And cell.Column = 1 Then
cell.Value = cell.Offset(⑴, 6).Value + 1
' Stop when the last day of the month has been entered.
If cell.Value > (FinalDay - StartDay) Then
cell.Value = ""
' Exit loop when calendar has correct number of days
' shown.
Exit For
End If
End If
Next
' Create Entry cells, format them centered, wrap text, and border
' around days.
For x = 0 To 5
Range("A4").Offset(x * 2, 0).EntireRow.Insert
With Range("A4:G4").Offset(x * 2, 0)
.RowHeight = 65
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = True
.Font.Size = 10
.Font.Bold = False
' Unlock these cells to be able to enter text later after
' sheet is protected.
.Locked = False
End With
' Put border around the block of dates.
With Range("A3").Offset(x * 2, 0).Resize(2, _
7).Borders(xlLeft)
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Range("A3").Offset(x * 2, 0).Resize(2, _
7).Borders(xlRight)
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Range("A3").Offset(x * 2, 0).Resize(2, 7).BorderAround _
Weight:=xlThick, ColorIndex:=xlAutomatic
Next
If Range("A13").Value = "" Then Range("A13").Offset(0, 0) _
.Resize(2, 8).EntireRow.Delete
' Turn off gridlines.
ActiveWindow.DisplayGridlines = False
' Protect sheet to prevent overwriting the dates.
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True
' Resize window to show all of calendar (may have to be adjusted
' for video configuration).
ActiveWindow.WindowState = xlMaximized
ActiveWindow.ScrollRow = 1
' Allow screen to redraw with calendar showing.
Application.ScreenUpdating = True
' Prevent going to error trap unless error found by exiting Sub
' here.
Exit Sub
' Error causes msgbox to indicate the problem, provides new input box,
' and resumes at the line that caused the error.
MyErrorTrap:
MsgBox "You may not have entered your Month and Year correctly." _
& Chr(13) & "Spell the Month correctly" _
& " (or use 3 letter abbreviation)" _
& Chr(13) & "and 4 digits for the Year"
MyInput = InputBox("Type in Month and year for Calendar")
If MyInput = "" Then Exit Sub
Resume
End Sub
VBA来自此网站 https://support.microsoft.com/en-us/kb/150774
2。 按 F5 键或 跑 按钮,并弹出一个对话框,提示您键入创建日曆所需的特定月份,请参见屏幕截图:
3。 点击 OK。 现在,将在活开工作表中创建一个2015年XNUMX月的日曆。
但是在上述方法中,存在一些局限性,举例来看,如果要一次创建从XNUMX月到XNUMX月的日曆,则需要使用上述两类方法5次创建日曆。 现在,我介绍一个方便的实用程序来快捷轻鬆地解决它
Perpetual Calendar 万年曆 是的强大工具之一 Excel,它可以帮助您一次在Excel中快捷创建每个月或每一年的日曆。
Excel, 与以上 300 方便的功能,使您的工作更加轻鬆。 | ||
1。 点击 企业 > 下载学习单 > Perpetual Calendar 万年曆。 看截图:
2.在弹出的对话框中,指定要创建日曆的月份延续时间,然后单击 创建。 看截图:
然后使用5个日曆工作表创建一个新的工作簿。 看截图:
小提示:
如果只想创建特定的月份日曆,则只需在对话框的“从”和“到”文本框当选择相同的月份。
单击此处以了解更多关于万年曆的信息
>>>>🚀🌟 点击注册 免费试用 更高级的-英雄云企业级云表单 🌟🚀 😃👉🌐>>>>
在现代企业管理中,数据的高效管理和处理至关重要。随着信息技术的不断发展,英雄云的云表单已经成为了提高数据录入、管理和分析效率的不可或缺的工具。让我们来深入探讨英雄云-云表单的几大优势。
基础字段:多样性满足业务需求
英雄云的云表单中包括了各种基础字段,如单行文本、多行文本、数字输入框、单选框、复选框、下拉框、下拉复选框、日期时间、分割线等。这些字段的多样性使用户可以根据具体的业务需求,轻松进行文本、数据和时间信息的录入或修改。例如,您可以使用单行文本字段录入员工姓名、产品型号等,或者使用下拉框进行多选,根据不同情况选择更加方便的字段类型。
高级字段:提升工作效率
英雄云的云表单还提供了高级字段,如地址、图片、附件、手写签名、手机、子表、关联数据、关联查询以及流水号。这些高级字段在基础字段的基础上升级,可帮助用户完成一些琐碎的工作。例如,使用地址字段可以避免逐字打字,而流水号字段可以自动生成规律性的编号,非常适用于合同编号生成等场景。
部门成员字段:精确管理与通讯录的关联
英雄云的部门成员字段允许企业对各个部门的成员进行精确管理。用户可以通过部门成员字段获取通讯录中的部门成员信息,应用于记录报销人、报销部门等场景。这些成员字段还细分为成员单选和成员多选,可根据具体需求在通讯录中选择一个或多个成员。
聚合表:数据处理更智能
英雄云的聚合表功能用于对已存在的表单数据进行聚合计算,从而得到一张聚合表,后续其他表单可调用聚合表进行数据联动、关联查询和关联数据等操作完成数据处理。这一功能可应用于多种场景,如进销存管理、财务管理和门店零售管理等,帮助企业完成数据处理,提高工作效率。
表单权限设置:灵活管理数据访问
英雄云的表单权限设置允许用户根据企业的具体需求管理表单的访问和操作权限。用户可以根据系统权限或自定义权限对不同成员或团队进行权限设置,以确保数据的安全和合规性。这一功能使企业能够根据变化的业务需求和团队结构,实时调整权限设置。
自定义打印模板:文档输出更便捷
英雄云的云表单支持自定义打印模板,可将表单数据转换为可打印的Word文档。用户可以根据自己的需求进行排版和编辑,将产品规格说明书等文档轻松生成。这一功能提供了一种标准化的文档输出方式,简化了信息整理的过程。
综合来看,选择英雄云的云表单意味着选择更智能、更灵活、更高效的数据管理工具。无论是提高工作效率,精确管理数据,还是实现数据处理,英雄云的云表单都能满足您的多样化需求,助力您的业务发展。
如果您正在寻找一款强大的云表单工具,不妨考虑英雄云,它将为您带来更多的便捷和智能,助您事半功倍。
免责声明:
本网址(www.yingxiongyun.com)发布的材料主要源于独立创作和网友匿名投稿。此处提供的所有信息仅供参考之用。我们致力于提供准确且可信的信息,但不对材料的完整性或真实性作出任何保证。用户应自行验证相关信息的正确性,并对其决策承担全部责任。对于由于信息的错误、不准确或遗漏所造成的任何损失,本网址不承担任何法律责任。本网站所展示的所有内容,如文字、图像、标志、音频、视频、软件和程序等的版权均属于原创作者。如果任何组织或个人认为网站内容可能侵犯其知识产权,或包含不准确之处,请即刻联系我们进行相应处理。
发表评论
暂时没有评论,来抢沙发吧~