<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Calendar Archives - Excel Zoom</title>
	<atom:link href="https://excelzoom.com/tag/calendar/feed/" rel="self" type="application/rss+xml" />
	<link>https://excelzoom.com/tag/calendar/</link>
	<description>...because it&#039;s more than just a calculator</description>
	<lastBuildDate>Mon, 16 Dec 2013 21:07:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>

<image>
	<url>https://excelzoom.com/wp-content/uploads/2022/04/favicon.ico</url>
	<title>Calendar Archives - Excel Zoom</title>
	<link>https://excelzoom.com/tag/calendar/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Create a Calendar in Excel</title>
		<link>https://excelzoom.com/how-to-create-a-calendar-in-excel/</link>
					<comments>https://excelzoom.com/how-to-create-a-calendar-in-excel/#comments</comments>
		
		<dc:creator><![CDATA[Mark]]></dc:creator>
		<pubDate>Wed, 04 Feb 2009 23:22:28 +0000</pubDate>
				<category><![CDATA[Macros]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Calendar]]></category>
		<guid isPermaLink="false">http://excelzoom.com/?p=65</guid>

					<description><![CDATA[<p>It&#8217;s always useful to have a calendar in Excel. Having one lets you save it on a shared network drive, so everyone involved in a particular project knows what&#8217;s going on and important dates coming up. Creating a calendar in Excel can be a tedious task if done manually. Thankfully, using the Visual Basic Editor, [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://excelzoom.com/how-to-create-a-calendar-in-excel/">How to Create a Calendar in Excel</a> appeared first on <a rel="nofollow" href="https://excelzoom.com">Excel Zoom</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>It&#8217;s always useful to have a calendar in Excel. Having one lets you save it on a shared network drive, so everyone involved in a particular project knows what&#8217;s going on and important dates coming up. Creating a calendar in Excel can be a tedious task if done manually. Thankfully, using the Visual Basic Editor, you can easily create a calendar in Excel.</p>
<p>By creating a simple macro, you can have Excel ask a user to input the month and year, and let Excel do the rest!<br />
<br />
I&#8217;m assuming that if you&#8217;re reading this you&#8217;ve already taken a look at my <a href="https://excelzoom.com/2009/02/install-and-use-macros/">guide that describes how to install and use macros</a>. If not, read up on the Single Workbook Use section for purposes of this macro.</p>
<p>I&#8217;ll explain each step of this macro code, and then put it all together at the end, to help you understand what it&#8217;s doing.</p>
<p>The first part of the code is to make sure the current sheet is unprotected. This will enable the macro to make the necessary edits to the sheet. This is accomplished with the following line:<br />
ActiveSheet.Protect DrawingObjects:=False, Contents:=False, _<br />
Scenarios:=False<br />
Application.ScreenUpdating = False</p>
<p>Next, you&#8217;ll want to make sure that any errors from data entry are resolved so that the macro can work properly. (More on this later).<br />
On Error GoTo ErrorMessage</p>
<p>Here, we&#8217;ll tell the macro to clear whatever is in the cells where we want the calendar to appear.<br />
Range(&#8220;A1:G14&#8221;).Clear</p>
<p>In order to get users to input a date, you&#8217;ll need to tell Excel to open an input box and ask the user to input the date. You&#8217;ll also want the date the user puts into the box to be defined as a variable. If they don&#8217;t input anything, or cancel out of the input box, you&#8217;ll want to end the process.<br />
InputDate = InputBox(&#8220;Type in Month and Year for Calendar &#8220;)<br />
If InputDate = &#8220;&#8221; Then Exit Sub</p>
<p>In order for the macro to properly format the calendar in Excel, it needs to know what the first day of the month is. Since we just had our users input the month and year, we need to convert this into a number that Excel recognizes as a date. You&#8217;ll also want to make sure that the date it is formatting is the first day in the month, otherwise tell it to change to the first day.<br />
FirstDay = DateValue(InputDate)<br />
If Day(FirstDay) &lt;&gt; 1 Then<br />
FirstDay = DateValue(Month(FirstDay) &amp; &#8220;/1/&#8221; &amp; _<br />
Year(FirstDay))<br />
End If</p>
<p>Next, you&#8217;ll want to start formatting your cells so it starts to look like a calendar.<br />
Range(&#8220;A1&#8221;).NumberFormat = &#8220;mmmm yyyy&#8221; &#8212; This formats the header to display just the month and year.<br />
Here, we set up the cells that will contain the days of the week<br />
With Range(&#8220;A1:G1&#8221;)<br />
.HorizontalAlignment = xlCenterAcrossSelection<br />
.VerticalAlignment = xlCenter<br />
.Font.Size = 18<br />
.Font.Bold = True<br />
.RowHeight = 35<br />
End With<br />
With Range(&#8220;A2:G2&#8221;)<br />
.ColumnWidth = 14<br />
.VerticalAlignment = xlCenter<br />
.HorizontalAlignment = xlCenter<br />
.VerticalAlignment = xlCenter<br />
.Orientation = xlHorizontal<br />
.Font.Size = 12<br />
.Font.Bold = True<br />
.RowHeight = 20<br />
End With<br />
Range(&#8220;A2&#8221;) = &#8220;Sunday&#8221;<br />
Range(&#8220;B2&#8221;) = &#8220;Monday&#8221;<br />
Range(&#8220;C2&#8221;) = &#8220;Tuesday&#8221;<br />
Range(&#8220;D2&#8221;) = &#8220;Wednesday&#8221;<br />
Range(&#8220;E2&#8221;) = &#8220;Thursday&#8221;<br />
Range(&#8220;F2&#8221;) = &#8220;Friday&#8221;<br />
Range(&#8220;G2&#8221;) = &#8220;Saturday&#8221;</p>
<p>Now we want to input the dates, and most importantly we want to put them in the correct location.<br />
With Range(&#8220;A3:G8&#8221;)<br />
.HorizontalAlignment = xlRight<br />
.VerticalAlignment = xlTop<br />
.Font.Size = 18<br />
.Font.Bold = True<br />
.RowHeight = 21<br />
End With<br />
Range(&#8220;A1&#8221;).Value = Application.Text(InputDate, &#8220;mmmm yyyy&#8221;)<br />
DayofWeek = Weekday(StartDay)<br />
CurrenttYear = Year(StartDay)<br />
CurrentMonth = Month(StartDay)<br />
LastDay = DateSerial(CurrentYear, CurrentMonth + 1, 1)<br />
Select Case DayofWeek<br />
Case 1<br />
Range(&#8220;A3&#8221;).Value = 1<br />
Case 2<br />
Range(&#8220;B3&#8221;).Value = 1<br />
Case 3<br />
Range(&#8220;C3&#8221;).Value = 1<br />
Case 4<br />
Range(&#8220;D3&#8221;).Value = 1<br />
Case 5<br />
Range(&#8220;E3&#8221;).Value = 1<br />
Case 6<br />
Range(&#8220;F3&#8221;).Value = 1<br />
Case 7<br />
Range(&#8220;G3&#8221;).Value = 1<br />
End Select</p>
<p>OK, now we have the first day of the month in, now we need to get the rest in, but considering that months all have different numbers of days, and some months (February) can have a different number of days from year to year, we need to tell the macro to only put as many days as there are in the month.<br />
For Each cell In Range(&#8220;A3:G8&#8221;)<br />
RowCell = cell.Row<br />
ColCell = cell.Column<br />
If cell.Column = 1 And cell.Row = 3 Then<br />
ElseIf cell.Column &lt;&gt; 1 Then<br />
If cell.Offset(0, -1).Value &gt;= 1 Then<br />
cell.Value = cell.Offset(0, -1).Value + 1<br />
If cell.Value &gt; (LastDay &#8211; FirstDay) Then<br />
cell.Value = &#8220;&#8221;<br />
Exit For<br />
End If<br />
End If<br />
ElseIf cell.Row &gt; 3 And cell.Column = 1 Then<br />
cell.Value = cell.Offset(-1, 6).Value + 1<br />
If cell.Value &gt; (LastDay &#8211; FirstDay) Then<br />
cell.Value = &#8220;&#8221;<br />
Exit For<br />
End If<br />
End If<br />
Next</p>
<p>Now that we have the dates, we&#8217;ll want to create a little space to enter in some data. To do this we&#8217;ll create a new row under each row that contains the dates.<br />
For x = 0 To 5<br />
Range(&#8220;A4&#8221;).Offset(x * 2, 0).EntireRow.Insert<br />
With Range(&#8220;A4:G4&#8221;).Offset(x * 2, 0)<br />
.RowHeight = 65<br />
.HorizontalAlignment = xlCenter<br />
.VerticalAlignment = xlTop<br />
.WrapText = True<br />
.Font.Size = 10<br />
.Font.Bold = False<br />
.Locked = False<br />
End With</p>
<p>Now we&#8217;ll format the calendar and the rest of the sheet so it actually looks like a calendar.<br />
With Range(&#8220;A3&#8221;).Offset(x * 2, 0).Resize(2, 7).Borders(xlLeft)<br />
.Weight = xlThick<br />
.ColorIndex = xlAutomatic<br />
End With<br />
With Range(&#8220;A3&#8221;).Offset(x * 2, 0).Resize(2, 7).Borders(xlRight)<br />
.Weight = xlThick<br />
.ColorIndex = xlAutomatic<br />
End With<br />
Range(&#8220;A3&#8221;).Offset(x * 2, 0).Resize(2, 7).BorderAround Weight:=xlThick, ColorIndex:=xlAutomatic<br />
Next<br />
If Range(&#8220;A13&#8221;).Value = &#8220;&#8221; Then Range(&#8220;A13&#8221;).Offset(0, 0) .Resize(2, 8).EntireRow.Delete<br />
ActiveWindow.DisplayGridlines = False<br />
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True<br />
ActiveWindow.WindowState = xlMaximized<br />
ActiveWindow.ScrollRow = 1</p>
<p>Now we&#8217;ll end the macro, assuming there were no errors encountered along the way.<br />
Application.ScreenUpdating = True<br />
Exit Sub</p>
<p>If there were errors, we&#8217;ll need to define the error message from above.<br />
ErrorCorrect:<br />
MsgBox &#8220;You may not have entered your Month and Year in the correct format.&#8221; _<br />
&amp; Chr(13) &amp; &#8220;Spell the Month correctly&#8221; _<br />
&amp; &#8221; (or use 3 letter abbreviation)&#8221; _<br />
&amp; Chr(13) &amp; &#8220;and 4 digits for the Year&#8221;<br />
InputDate = InputBox(&#8220;Type in Month and Year for Calendar&#8221;)<br />
If InputDate = &#8220;&#8221; Then Exit Sub<br />
Resume<br />
End Sub</p>
<p>Now that you&#8217;ve seen the pieces, here&#8217;s the complete code.<br />
</p>


<p>The post <a rel="nofollow" href="https://excelzoom.com/how-to-create-a-calendar-in-excel/">How to Create a Calendar in Excel</a> appeared first on <a rel="nofollow" href="https://excelzoom.com">Excel Zoom</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://excelzoom.com/how-to-create-a-calendar-in-excel/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
			</item>
	</channel>
</rss>
