cmalifarge
XLDnaute Nouveau
Bonjour,
j'utilise le code ci dessous pour générer un calendrier. j'aimerai intercaler 4 colonnes entre chaque mois.
Est ce que cela est possible? et quelqu'un aurait il une solution?
Dim Cal As Range, cell As Range
Set Cal = Range("B4:M34")
Cal.ClearComments
For Each cell In Cal
If cell.Text <> "" Then
If Weekday(cell.Value2, vbMonday) = 1 Then
cell.AddComment "Semaine " & NoSem(cell.Value)
cell.Comment.Shape.TextFrame.AutoSize = True
End If
End If
Next cell
End Sub
Function NoSem(D As Date) As Long
'L. Longre
D = Int(D)
NoSem = DateSerial(Year(D + (8 - Weekday(D)) Mod 7 - 3), 1, 1)
NoSem = ((D - NoSem - 3 + (Weekday(NoSem) + 1) Mod 7)) \ 7 + 1
End Function
Bien cordialement
j'utilise le code ci dessous pour générer un calendrier. j'aimerai intercaler 4 colonnes entre chaque mois.
Est ce que cela est possible? et quelqu'un aurait il une solution?
Dim Cal As Range, cell As Range
Set Cal = Range("B4:M34")
Cal.ClearComments
For Each cell In Cal
If cell.Text <> "" Then
If Weekday(cell.Value2, vbMonday) = 1 Then
cell.AddComment "Semaine " & NoSem(cell.Value)
cell.Comment.Shape.TextFrame.AutoSize = True
End If
End If
Next cell
End Sub
Function NoSem(D As Date) As Long
'L. Longre
D = Int(D)
NoSem = DateSerial(Year(D + (8 - Weekday(D)) Mod 7 - 3), 1, 1)
NoSem = ((D - NoSem - 3 + (Weekday(NoSem) + 1) Mod 7)) \ 7 + 1
End Function
Bien cordialement