Write The Days Of This Month To The Right Write The Day To The Child Cell And Color The Weekends Online Excel and Excel Macro (VBA) Courses Copy Macro 'For online Excel courses click: https://www.excelsizeyeter.com/excelwithkenan.com/udemy_giris.php Sub Ayarla() Dim Ayin_Ilk_Gunu As Date, Ayin_Son_Gunu As Date, Hedef As Range, Adres As String Ayin_Ilk_Gunu = DateSerial(Year(Now), Month(Now), 1) Ayin_Son_Gunu = DateSerial(Year(Now), Month(Now) + 1, 1) - 1 On Error Resume Next ActiveWorkbook.Names("Bayramlar").Delete On Error GoTo 0 ActiveWorkbook.Names.Add Name:="Bayramlar", RefersToR1C1:= _ "={" & CDbl(CDate("23.04.2007")) & ";" & CDbl(CDate("19.05.2007")) & ";" & CDbl(CDate("23.10.2007")) & ";" & CDbl(CDate("24.10.2007")) & ";" & CDbl(CDate("25.10.2007")) & ";" & _ CDbl(CDate("29.10.2007")) & ";" & CDbl(CDate("31.12.2007")) & ";" & CDbl(CDate("01.01.2008")) & ";" & CDbl(CDate("02.01.2008")) & ";" & CDbl(CDate("03.01.2008")) & "}" Set Hedef = Range("A5") Hedef = Ayin_Ilk_Gunu Hedef.NumberFormat = "DD" With Hedef Adres = .Address(True, False) .Select .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:= _ "=VE(" & Adres & """"";YADA(DEĞİL(EHATALIYSA(DÜŞEYARA(" & Adres & ";Bayramlar;1;0)));HAFTANINGÜNÜ(" & Adres & ";2)=6;HAFTANINGÜNÜ(" & Adres & ";2)=7))" .FormatConditions(1).Interior.ColorIndex = 3 End With With Hedef(2, 1) .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:= _ "=VE(" & Adres & """"";YADA(DEĞİL(EHATALIYSA(DÜŞEYARA(" & Adres & ";Bayramlar;1;0)));HAFTANINGÜNÜ(" & Adres & ";2)=6;HAFTANINGÜNÜ(" & Adres & ";2)=7))" .FormatConditions(1).Interior.ColorIndex = 3 End With Hedef.DataSeries Rowcol:=xlRows, Type:=xlChronological, Date:=xlDay, _ Step:=1, stop:=CDbl(Ayin_Son_Gunu), Trend:=False Hedef.AutoFill Destination:=Range(Hedef, Hedef.End(xlToRight)), Type:=xlFillDefault Hedef(2, 1) = Format(Hedef(1, 1), "DDD") Hedef(2, 1).AutoFill Destination:=Range(Hedef(2, 1), Hedef.End(xlToRight)(2, 1)), Type:=xlFillDefault Range(Hedef(2, 1).EntireColumn, Hedef.End(xlToRight)(2, 1).EntireColumn).Columns.AutoFit Hedef(3, 1).Formula = "=IF(AND(OR(WEEKDAY(" & Adres & ",2)=1,WEEKDAY(" & Adres & ",2)=3,WEEKDAY(" & Adres & ",2)=5),ISERROR(VLOOKUP(" & Adres & ",Bayramlar,1,0))),10,IF(AND(OR(WEEKDAY(" & Adres & ",2)=2,WEEKDAY(" & Adres & ",2)=4),ISERROR(VLOOKUP(" & Adres & ",Bayramlar,1,0))),4,0))" Hedef(3, 1).AutoFill Destination:=Range(Hedef(3, 1), Hedef.End(xlToRight)(3, 1)), Type:=xlFillDefault Set Hedef = Nothing End Sub Report problem with this macro This macro does not work. There's an error in the code. Other You can write your comments about the error in the box below. Report error ALL MACROS Youtube Channel The following macros may be useful for you. Similar Results NoMacro Name 1 write the days of this month to the right write the day to the child cell and color the weekends 2 excel operators hk 3 When you click on any cell, it scrolls to the right and writes the numbers of the days in that month and color the weekends. 4 click any cell and scroll to the right to write the number of days in that month 5 inserts months as sheet / pages Specifies days in detail 6 Adds months as a sheet / page and writes the days of the month and goes to the active month and day 7 summer adds months to sheet / pages 8 finds the last day of the month writes to the active cell 9 The background of cells a1: m8 flashes 10 Background of cells "a1: m8" flashes 11 writes the names of all sheet / pages from the active sheet / page and cell and adds a link to the sheet / pages 12 Inputbox add year as summer 13 background flashes 14 write the number you want to be colored on the sheet / page in msgbox 15 Extracting values from cells 16 flashing 17 Data between cells a1: af12 flashes 18 Data between cells a1: af12 flashes 19 number of days in the cell 20 write to the cell delete the range of data to be deleted (deletes from sheet / page1 and sheet / page2 on sheet / page1 to a2b2)