如何在Excel中創建每月/每年的日歷?

      網友投稿 543 2025-03-31

      如何在Excel中創建每月/每年的日歷?

      在某些時候,您需要在Excel中創建特定的月或年日歷,如何快速解決呢? 本教程介紹了在Excel中快速創建每月或每年日歷的技巧。

      通過Excel模板創建每月或每年的日歷

      通過VBA創建月歷

      通過萬年歷輕松創建月度或年度日歷

      通過Excel模板創建每月或每年的日歷
      驚人的! 在 Excel 中使用高效的選項卡,如 Chrome、Firefox 和 Safari! 每天節省50%的時間,并減少數千次鼠標單擊!

      在Excel中,您可以使用日歷模板來創建每月或每年的日歷。

      1.在Excel 2010/2013中,單擊 文件 > 全新,在Excel 2007中,單擊 辦公按鈕 > 全新,然后在彈出窗口的右側部分中輸入 日歷 進入搜索引擎。 看截圖:

      在Excel 2010/2013中

      在Excel 2007中

      2。 按 輸入,然后窗口中會列出多種類型的日歷。 選擇所需的一種日歷,然后單擊 下載(或創建) 在右窗格中。 看截圖:

      現在,在新工作簿中創建了一個日歷。 看截圖:

      通過VBA創建月歷

      有時,您需要為指定的月份創建一個月的日歷,例如2015年XNUMX月。使用上述方法很難找到這樣的日歷模板。 在這里,我介紹了VBA代碼,以幫助您創建特定的每月日歷。

      如何在Excel中創建每月/每年的日歷?

      1。 按 Alt + F11鍵 打開鑰匙 Microsoft Visual Basic應用程序 窗口中,單擊 插頁 > 模塊,然后將以下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, -1).Value >= 1 Then cell.Value = cell.Offset(0, -1).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(-1, 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
      Copy

      VBA來自此網站 https://support.microsoft.com/en-us/kb/150774

      2。 按 F5 鍵或 運行 按鈕,并彈出一個對話框,提醒您鍵入創建日歷所需的特定月份,請參見屏幕截圖:

      3。 點擊 OK。 現在,將在活動工作表中創建一個2015年XNUMX月的日歷。

      但是在上述方法中,存在一些局限性,例如,如果要一次創建從一月到五月的日歷,則需要使用上述兩種方法五次創建日歷。 現在,我介紹一個方便的實用程序來快速輕松地解決它

      通過萬年歷輕松創建月度或年度日歷

      Perpetual Calendar 是的強大工具之一 Kutools for Excel,它可以幫助您一次在Excel中快速創建每月或每年的日歷。

      Kutools for Excel, 與超過 300 方便的功能,使您的工作更加輕松。 
      免費下載功能齊全60天免費試用

      1。 點擊 企業 > 工作表 > Perpetual Calendar。 看截圖:

      2.在彈出的對話框中,指定要創建日歷的月份持續時間,然后單擊 創建。 看截圖:

      然后使用五個日歷工作表創建一個新的工作簿。 看截圖:

      提示:

      如果只想創建特定的月份日歷,則只需在對話框的“從”和“到”文本框中選擇相同的月份。

      單擊此處以了解更多關于萬年歷的信息

      最佳辦公生產力工具

      將小時轉化為分鐘 Kutools for Excel!

      準備好增強您的 Excel 任務了嗎? 利用的力量 Kutools for Excel - 您終極的節省時間的工具。 簡化復雜的任務并像專業人士一樣瀏覽數據。 以閃電般的速度體驗 Excel!

      為什么需要 Kutools for Excel

      ???  超過 300 項強大功能: Kutools 包含 300 多項高級功能,可簡化您在 1500 多種場景中的工作。

      ??  卓越的數據處理能力:合并單元格、刪除重復項并執行高級數據轉換 - 所有這些都不費吹灰之力!

      ??  高效的批量操作:當你可以聰明地工作時,為什么還要付出額外的努力呢? 輕松批量導入、導出、組合和調整數據。

      ??  可定制的圖表和報告:訪問各種附加圖表并生成富有洞察力的報告。

      ???  強大的導航窗格:通過強大的列管理器、工作表管理器和自定義收藏夾獲得優勢。

      ??  七種類型的下拉列表:通過各種功能和類型的下拉列表使數據輸入變得輕而易舉。

      ??  用戶友好:對于初學者來說輕而易舉,對于專家來說是一個強大的工具。

      立即下載,與 Excel 一起穿越時空!

      閱讀更多 免費下載... 采購... 
      Office Tab 為 Office 帶來選項卡式界面,讓您的工作更輕松
      在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。 在同一窗口的新選項卡中而不是在新窗口中打開并創建多個文檔。 每天將您的工作效率提高50%,并減少數百次鼠標單擊!
      閱讀更多 免費下載... 采購... 

      版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。

      版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。

      上一篇:WPS全新組件“輕辦公”輕松實現團隊協作(wps辦公軟件)
      下一篇:怎樣在Word中實現表格行列互換(word里面表格怎么行列互換)
      相關文章
      亚洲精品美女久久久久| 青青草原精品国产亚洲av| 亚洲欧洲日产国码在线观看| 久久亚洲AV午夜福利精品一区| 国产午夜亚洲精品午夜鲁丝片 | 日韩精品成人亚洲专区| 亚洲欧洲无码一区二区三区| 亚洲中文字幕无码久久| 亚洲日本VA午夜在线影院| 中日韩亚洲人成无码网站| 亚洲激情视频图片| 日韩亚洲产在线观看| 亚洲色大成网站WWW国产| 亚洲国产成人手机在线观看| 亚洲日韩在线中文字幕综合| 国产精品自拍亚洲| 亚洲精品国产va在线观看蜜芽| 亚洲日韩中文字幕日韩在线| 亚洲色中文字幕无码AV| 亚洲成色www久久网站夜月| 久久亚洲日韩精品一区二区三区| 日韩亚洲Av人人夜夜澡人人爽| 亚洲第一二三四区| 亚洲AV无码一区二区三区人 | 激情亚洲一区国产精品| 亚洲综合色丁香婷婷六月图片| 亚洲中文字幕久久无码| 日本亚洲欧美色视频在线播放| 精品久久久久亚洲| 国产精品亚洲mnbav网站 | 精品久久久久亚洲| 国产亚洲精品精品国产亚洲综合 | 国产亚洲国产bv网站在线| 亚洲最大的成人网站| 亚洲av日韩专区在线观看| yy6080亚洲一级理论| 最新精品亚洲成a人在线观看| 亚洲AV无码一区东京热| 中文字幕亚洲免费无线观看日本| 亚洲一级黄色大片| 亚洲av无码专区国产不乱码 |