<?xml version="1.0" encoding="iso-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Dansk Regneark Forum : Kalender vbap</title>
  <link>https://forum.excel-regneark.dk/</link>
  <description><![CDATA[Dette er et XML Feed af; Dansk Regneark Forum : Makro og VBA : Kalender vbap]]></description>
  <pubDate>Sat, 05 Dec 2026 13:23:53 +0000</pubDate>
  <lastBuildDate>Sun, 13 Jan 2013 14:04:15 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.08</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>https://forum.excel-regneark.dk/RSS_post_feed.asp?TID=1016</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Dansk Regneark Forum]]></title>
   <url>https://forum.excel-regneark.dk/css_styles/Excel-regneark.dk/logo.png</url>
   <link>https://forum.excel-regneark.dk/</link>
  </image>
  <item>
   <title><![CDATA[Kalender vbap : Hold da op Jeg kan se, at det...]]></title>
   <link>https://forum.excel-regneark.dk/kalender-vbap_topic1016_post4884.html#4884</link>
   <description>
    <![CDATA[<strong>Forfatter:</strong> <a href="https://forum.excel-regneark.dk/member_profile.asp?PF=732">EXCELGAARD</a><br /><strong>Emne:</strong> 1016<br /><strong>Sendt:</strong> 13.Jan.2013 kl. 14:04<br /><br />Hold da op <img src="https://forum.excel-regneark.dk/smileys/smiley3.gif" border="0" alt="Shocked" title="Shocked" /><br><br>Jeg kan se, at det er mine gamle Påskedag og Helligdags funktioner, der er i brug her <img src="https://forum.excel-regneark.dk/smileys/smiley4.gif" border="0" alt="Big smile" title="Big smile" /><br>Dem har jeg ikke set siden slutningen af 1990'erne!<br><br>Ja, det var sådan jeg gjorde dengang, hvor jeg var ny og grøn ud i VBA-kode - der er godt nok løbet meget vand under broen siden <img src="https://forum.excel-regneark.dk/smileys/smiley17.gif" border="0" alt="T&#111;ngue" title="T&#111;ngue" /><br>I dag er funktionerne langt mere fleksible og brugbare - for ikke, at snakke om mere professionelt opbyggede - måske jeg skulle smide dem ud på mit website igen???<br><br>Anyway, prøv, at uploade dit regneark til forummet, og jeg skal prøve, at tage et kig på det...<br>]]>
   </description>
   <pubDate>Sun, 13 Jan 2013 14:04:15 +0000</pubDate>
   <guid isPermaLink="true">https://forum.excel-regneark.dk/kalender-vbap_topic1016_post4884.html#4884</guid>
  </item> 
  <item>
   <title><![CDATA[Kalender vbap : Jeg harfundet en programkode p&#229;...]]></title>
   <link>https://forum.excel-regneark.dk/kalender-vbap_topic1016_post4803.html#4803</link>
   <description>
    <![CDATA[<strong>Forfatter:</strong> <a href="https://forum.excel-regneark.dk/member_profile.asp?PF=182">timer</a><br /><strong>Emne:</strong> 1016<br /><strong>Sendt:</strong> 05.Jan.2013 kl. 00:20<br /><br />Jeg har&nbsp;fundet en programkode på en kalender der køres med en makro, kalenderen virker stort set&nbsp;rigtig godt, men der er blot en enkelt fejl i kalenderen, og som jeg vil høre jer om, om&nbsp;i kan hjælpe mig med.<DIV>&nbsp;</DIV><DIV>Fejlen ligger i februar måned d. 29, i de årstal hvor der er skudår er den god nok, men de øvrige 3 år imellem er d. 29 med og med forkert dag angivet.</DIV><DIV>&nbsp;</DIV><DIV>Kan man slette / rette denne fejl ?</DIV><DIV>&nbsp;</DIV><DIV>indsætter lige koden her.</DIV><DIV>&nbsp;</DIV><DIV>Glæder mig til at høre fra jer.</DIV><DIV>Timer.</DIV><DIV>&nbsp;</DIV><DIV>Programkode: </DIV><DIV>&nbsp;</DIV><DIV><P style="MARGIN: 0cm 0cm 0pt" =Ms&#111;normal><SPAN style="COLOR: black"><FONT face="Arial, Helvetica, sans-serif"><FONT =rtb4>Åben et tomt regneark, højreklik på arknavn (i bunden), vælg vis programkode, indsæt nedenstående kode i visual basic, vend tilbage til arket, tryk alt+f8, vælg "Afspil",&nbsp;du skulle nu kunne vælge årstal for den ønskede&nbsp;kalender.<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT> </FONT></SPAN></P><P style="MARGIN: 0cm 0cm 0pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 8.5pt"><FONT face=""><o:p>&nbsp;</o:p> </FONT></SPAN></P><P style="MARGIN: 0cm 0cm 0pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 8.5pt"><BR><BR><FONT face="">Function Påskedag(InputYear As Integer) As Long ' Returnerer datoen for Påskedag<BR>Dim d As Integer<BR>&nbsp; &nbsp; d = (((255 - 11 * (InputYear Mod 19)) - 21) Mod 30) + 21<BR>&nbsp; &nbsp; Påskedag = DateSerial(InputYear, 3, 1) + d + (d &gt; 48) + 6 - _<BR>&nbsp; &nbsp; &nbsp; &nbsp; ((InputYear + InputYear \ 4 + d + (d &gt; 48) + 1) Mod 7)<BR>End Function<BR><BR>Function HelligdagsNavn(lngdate As Long) As String<BR>' bruger funktionen Påskedag<BR>Dim InputYear As Integer, PD As Long, OK As Boolean<BR>&nbsp; &nbsp; If lngdate &lt;= 0 Then lngdate = Date<BR>&nbsp; &nbsp; InputYear = Year(lngdate)<BR>&nbsp; &nbsp; PD = Påskedag(InputYear)<BR>&nbsp; &nbsp; &nbsp; OK = True<BR>&nbsp; &nbsp; Select Case lngdate ' Tester nedenstående påstande mod datoen<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case DateSerial(InputYear, 1, 1): HelligdagsNavn = "Nytårsdag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case PD - 3: HelligdagsNavn = "Skærtorsdag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case PD - 2: HelligdagsNavn = "Langfredag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case PD: HelligdagsNavn = "Påskedag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case PD + 1: HelligdagsNavn = "2. Påskedag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case DateSerial(InputYear, 6, 5): HelligdagsNavn = "Grundlovsdag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case PD + 26: HelligdagsNavn = "Store Bededag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case PD + 39: HelligdagsNavn = "Kristi Himmelfartsdag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case PD + 49: HelligdagsNavn = "Pinsedag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case PD + 50: HelligdagsNavn = "2. </FONT></SPAN><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 8.5pt; mso-ansi-: EN-GB" lang=EN-GB><FONT face="">Pinsedag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case DateSerial(InputYear, 12, 24): HelligdagsNavn = "Julaftensdag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case DateSerial(InputYear, 12, 25): HelligdagsNavn = "1.Juledag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case DateSerial(InputYear, 12, 26): HelligdagsNavn = "2.Juledag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case DateSerial(InputYear, 12, 31): HelligdagsNavn = "Nytårsaftensdag"<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case Else<BR>&nbsp; &nbsp; &nbsp; End Select<BR>&nbsp; &nbsp; &nbsp; &nbsp; OK = False<BR>End Function<BR>Public Sub Kalender()<BR>Dim År As Integer, Dato As Date, DD As Long, Md As Variant, Dag As Variant, HD As String<BR>Md = Array("", "Januar", "Febuar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December")<BR>Dag = Array("", "S", "M", "T", "O", "T", "F", "L")<BR>År = InputBox(" Indtast årstal for kalender")<BR>Application.ScreenUpdating = False<BR>Cells.MergeCells = False<BR>Range("A1") = ""<BR>Range("A1:R1").Interior.ColorIndex = 50<BR>Range("A2:R2").Interior.ColorIndex = 38<BR>Range("A3:R33").Font.ColorIndex = xlAutomatic<BR>Range("A35:R65").Font.ColorIndex = xlAutomatic<BR>For a = 1 To 6<BR>Cells(2, a * 3) = Md(a)<BR>Next<BR>Dato = "01-01-" &amp; År<BR>For K = 1 To 18 Step 3<BR>Call MDRamme(K, 2)<BR>Olddato = Dato<BR>For I = 3 To 33<BR>DD = DateValue(Dato)<BR>HD = HelligdagsNavn(DD)<BR>Cells(I, K) = Dag(Weekday(Dato))<BR>Select Case Weekday(Dato)<BR>Case 1, 7<BR>&nbsp; &nbsp; Range(Cells(I, K), Cells(I, K + 2)).Interior.ColorIndex = 15<BR>&nbsp; &nbsp; Cells(I, K + 2) = HD<BR>&nbsp; Case 2<BR>&nbsp; &nbsp; Cells(I, K + 2) = ""<BR>&nbsp; &nbsp; Cells(I, K + 2) = "'" &amp; DatePart("ww", Dato, vbMonday, vbFirstFourDays) &amp; " " &amp; HD<BR>&nbsp; If HD = "" Then<BR>&nbsp; &nbsp; Range(Cells(I, K), Cells(I, K + 2)).Interior.ColorIndex = xlNone<BR>&nbsp; Else<BR>&nbsp; &nbsp; Range(Cells(I, K), Cells(I, K + 2)).Interior.ColorIndex = 40<BR>&nbsp; End If<BR>&nbsp; <BR>&nbsp; Cells(I, K + 2).Font.ColorIndex = xlAutomatic<BR>&nbsp; If IsNumeric(Left(Cells(I, K + 2).Value, 1)) And IsNumeric(Mid(Cells(I, K + 2).Value, 1, 1)) Then<BR>&nbsp; &nbsp; &nbsp; Cells(I, K + 2).Characters(Start:=1, Length:=2).Font.ColorIndex = 5<BR>&nbsp; Else<BR>&nbsp; &nbsp; &nbsp; Cells(I, K + 2).Characters(Start:=1, Length:=1).Font.ColorIndex = 5<BR>&nbsp; End If<BR>Case Else<BR>&nbsp; Cells(I, K + 2) = HD<BR>&nbsp; If HD = "" Then<BR>&nbsp; Range(Cells(I, K), Cells(I, K + 2)).Interior.ColorIndex = xlNone<BR>&nbsp; Else<BR>&nbsp; Range(Cells(I, K), Cells(I, K + 2)).Interior.ColorIndex = 40<BR>&nbsp; End If<BR>End Select<BR>Cells(I, K + 1) = Day(Dato)<BR>HD = ""<BR>Dato = Dato + 1<BR>If Month(Dato) &lt;&gt; Month(Olddato) Then Exit For<BR>Next<BR>Next<BR><BR>' -----------------næste halve år -------------<BR>Range("A34:R34").Interior.ColorIndex = 38<BR>For a = 7 To 12<BR>&nbsp; Cells(34, (a - 6) * 3) = Md(a)<BR>Next<BR>For K = 1 To 18 Step 3<BR>Call MDRamme(K, 34)<BR>For I = 35 To 65<BR>Olddato = Dato<BR>DD = DateValue(Dato)<BR>HD = HelligdagsNavn(DD)<BR>Cells(I, K) = Dag(Weekday(Dato))<BR>Select Case Weekday(Dato)<BR>Case 1, 7<BR>&nbsp; &nbsp; Range(Cells(I, K), Cells(I, K + 2)).Interior.ColorIndex = 15<BR>&nbsp; &nbsp; Cells(I, K + 2) = HD<BR>Case 2<BR>&nbsp; Cells(I, K + 2) = "'" &amp; DatePart("ww", Dato, vbMonday, vbFirstFourDays) &amp; " " &amp; HD<BR>&nbsp; If HD = "" Then<BR>&nbsp; &nbsp; Range(Cells(I, K), Cells(I, K + 2)).Interior.ColorIndex = xlNone<BR>&nbsp; Else<BR>&nbsp; &nbsp; Range(Cells(I, K), Cells(I, K + 2)).Interior.ColorIndex = 40<BR>&nbsp; End If<BR>&nbsp; Cells(I, K + 2).Font.ColorIndex = xlAutomatic<BR>&nbsp; If IsNumeric(Left(Cells(I, K + 2).Value, 1)) And IsNumeric(Mid(Cells(I, K + 2).Value, 1, 1)) Then<BR>&nbsp; &nbsp; &nbsp; Cells(I, K + 2).Characters(Start:=1, Length:=2).Font.ColorIndex = 5<BR>&nbsp; Else<BR>&nbsp; &nbsp; &nbsp; Cells(I, K + 2).Characters(Start:=1, Length:=1).Font.ColorIndex = 5<BR>&nbsp; End If<BR>Case Else<BR>&nbsp; Cells(I, K + 2) = HD<BR>&nbsp; If HD = "" Then<BR>&nbsp; Range(Cells(I, K), Cells(I, K + 2)).Interior.ColorIndex = xlNone<BR>&nbsp; Else<BR>&nbsp; Range(Cells(I, K), Cells(I, K + 2)).Interior.ColorIndex = 40<BR>&nbsp; End If<BR>End Select<BR>&nbsp; HD = ""<BR>&nbsp; Cells(I, K + 1) = Day(Dato)<BR>&nbsp; Dato = Dato + 1<BR>&nbsp; If Month(Dato) &lt;&gt; Month(Olddato) Then Exit For<BR>Next<BR>Next<BR>&nbsp; &nbsp; Range("A1:R65").Select<BR>&nbsp; &nbsp; Range("R65").Activate<BR>&nbsp; &nbsp; Range("A3:R33,A35:R65").Font.Size = 8<BR>&nbsp; &nbsp; Range("A3:R33,A35:R65").Borders.LineStyle = xlContinuous<BR>&nbsp; &nbsp; Columns("A:R").Select<BR>&nbsp; &nbsp; Columns("A:R").EntireColumn.AutoFit<BR>&nbsp; &nbsp; Range("C:C,F:F,I:I,L:L,O:O,R:R").ColumnWidth = 10<BR>&nbsp; &nbsp; Rows("34:34").Select<BR>&nbsp; &nbsp; ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell<BR>&nbsp; &nbsp; Range("3:33,35:65").RowHeight = 12<BR>&nbsp; &nbsp; ActiveSheet.PageSetup.PrintTitleRows = "$1:$1"<BR>&nbsp; With ActiveSheet.PageSetup<BR>&nbsp; &nbsp; &nbsp; &nbsp; .Orientation = xlLandscape<BR>&nbsp; &nbsp; &nbsp; &nbsp; .Zoom = 120<BR>&nbsp; &nbsp; &nbsp; &nbsp; .TopMargin = Application.InchesToPoints(1)<BR>&nbsp; &nbsp; &nbsp; &nbsp; .BottomMargin = Application.InchesToPoints(0)<BR>&nbsp; &nbsp; &nbsp; &nbsp; .HeaderMargin = Application.InchesToPoints(0)<BR>&nbsp; &nbsp; &nbsp; &nbsp; .FooterMargin = Application.InchesToPoints(0)<BR>&nbsp; &nbsp; End With<BR>&nbsp; &nbsp; Range("A1:R1").Merge<BR>&nbsp; &nbsp; Range("A1:R1").Borders.LineStyle = xlContinuous<BR>&nbsp; &nbsp; Range("A1:R1").HorizontalAlignment = xlCenter<BR>&nbsp; &nbsp; Range("A1") = År<BR>&nbsp; &nbsp; Range("A1").Select<BR>&nbsp; Application.ScreenUpdating = True<BR>End Sub<BR>Sub MDRamme(KO, RK)<BR>&nbsp; &nbsp; Range(Cells(RK, KO), Cells(RK, KO + 2)).Select<BR>&nbsp; &nbsp; &nbsp; &nbsp; With Selection.Borders(xlEdgeLeft)<BR>&nbsp; &nbsp; &nbsp; &nbsp; .LineStyle = xlContinuous<BR>&nbsp; &nbsp; &nbsp; &nbsp; .Weight = xlMedium<BR>&nbsp; &nbsp; &nbsp; &nbsp; .ColorIndex = xlAutomatic<BR>&nbsp; &nbsp; End With<BR>&nbsp; &nbsp; With Selection.Borders(xlEdgeTop)<BR>&nbsp; &nbsp; &nbsp; &nbsp; .LineStyle = xlContinuous<BR>&nbsp; &nbsp; &nbsp; &nbsp; .Weight = xlMedium<BR>&nbsp; &nbsp; &nbsp; &nbsp; .ColorIndex = xlAutomatic<BR>&nbsp; &nbsp; End With<BR>&nbsp; &nbsp; With Selection.Borders(xlEdgeBottom)<BR>&nbsp; &nbsp; &nbsp; &nbsp; .LineStyle = xlContinuous<BR>&nbsp; &nbsp; &nbsp; &nbsp; .Weight = xlMedium<BR>&nbsp; &nbsp; &nbsp; &nbsp; .ColorIndex = xlAutomatic<BR>&nbsp; &nbsp; End With<BR>&nbsp; &nbsp; With Selection.Borders(xlEdgeRight)<BR>&nbsp; &nbsp; &nbsp; &nbsp; .LineStyle = xlContinuous<BR>&nbsp; &nbsp; &nbsp; &nbsp; .Weight = xlMedium<BR>&nbsp; &nbsp; &nbsp; &nbsp; .ColorIndex = xlAutomatic<BR>&nbsp; &nbsp; End With<BR>&nbsp; &nbsp; Selection.Borders(xlInsideVertical).LineStyle = xlNone<BR>End Sub</FONT></SPAN> <SPAN style="mso-ansi-: EN-GB" lang=EN-GB><o:p></o:p></SPAN></P><DIV =tmpMainClear></DIV></DIV>]]>
   </description>
   <pubDate>Sat, 05 Jan 2013 00:20:57 +0000</pubDate>
   <guid isPermaLink="true">https://forum.excel-regneark.dk/kalender-vbap_topic1016_post4803.html#4803</guid>
  </item> 
 </channel>
</rss>