Arrays in VBA. How to store values at each step of the cycle?

Essence. You need to create N sheets format "01.06. The resurrection.06" and so on until the end of the month. Can't save found "Sunday" of the month in the array. For the life of me.
Private Sub cmd_1_Click()

 Dim NeuPapier As Worksheet 'create a additional sheet for weeks
 Dim NahmePapier As String ' name of the worksheet
 'Dim PreFixDate As String 'do we need a zero before the number
 Dim arrSonntag() As String

 Heute = DatePart("d", Now) 'returns today's date
 Monate = MonthName(Month(Now - Heute)) 'previous month to copy
 DerTag = Day(DateAdd("d", -1, DateAdd("m", 1, Now - Heute + 1))) 'the number of the days of the present month

 Sheets(Monate).Copy after:=Sheets(Monate)
 Nahme = Monate & "" & "(2)" 'specify the name of the sheet
 Sheets(Nahme).Name = MonthName(Month(Now))

 If DerTag = 30 Then


 For i = 0 To DerTag 'loop to input date

 Sheets(MonthName(Month(Now))).Cells(5 + i, 2) = Now - Heute + i

 Next i

 NewMonate = Day(Sheets(MonthName(Month(Now))).Cells(5 + 1, 2)) & "." & Month(Now) 'the beginning of the month
 EndMonate = Day(Sheets(MonthName(Month(Now))).Cells(5 + 30, 2)) & "." & Month(Now) 'the end of the month

 '1. need to create N-th number of leaves of the format "01.MM - 1BB.MM", "1BB+1.MM - 2ВВ.MM", "2ВВ+1.MM - 3ВВ.MM", "3ВВ+1.MM - 4ВВ.MM", "4ВВ.MM - KK.MM"
 '2. for this you need to create an array with all the residence. inside

 For i = 1 To DerTag

 If WeekdayName(Weekday(Sheets(MonthName(Month(Now))).Cells(5 + i, 2), vbMonday)) = "Sunday" Then 'iterates through all cells in search of resurrection

 End If

 Next i
July 8th 19 at 15:57
1 answer
July 8th 19 at 15:59
Thank you all, solved through the collection

Find more questions by tags ExcelVisual Basic