Loop in the same line

Occasional Contributor

Hi all,


From B2 column to AF2 column, I need to display all days of a specific month.

The starting and last day for every month, are displayed in another Sheet. On the actual Sheet who I need to display something like a Calendar in VBA, I can only display the starting date, but I don't know how to loop to other columns. There is what I tried to do:

Function FicheAbsence(NomFeuille As String)
    Dim Var As Variant
    Dim FL1 As Worksheet
    Dim c As Integer
    Range("B1").Value = NomFeuille
    For i = 1 To 12
        If NomFeuille = Application.Sheets("DB").Range("A" & i + 3).Value Then
            Range("B2").Value = Application.Sheets("DB").Range("B" & i + 3).Value
        End If
    Next i
End Function

How can I loop in different columns but in the same line. The first day is displayed in B2.


0 Replies