Bonjour à tous,
Je rencontre une grosse difficulté.
à mon travail, mscal.ocx n'est présent sur aucun de nos PC du coup la fonction weekday ne fonctionne pas.
Dans les références j'ai manquant : Microsoft Control Calendar 11.0
Nos informaticiens m'affirme qu'ils ne peuvent pas nous mettre cette bibliothèque pour x raisons. Du coup je dois m'en passer.
Par quoi puis-je la remplacer ?
Private Sub ComboBox2_Change()
Dim j As Long, joursj As Date
joursj = MonthView1.Value
With Sheets("Personnel")
For j = 2 To .Range("A" & Rows.Count).End(xlUp).Row
If .Range("A" & j) & " " & .Range("B" & j) = Me.ComboBox2 Then
If Weekday(joursj) = 2 Then 'Lundi
Me.TextBox1.Value = Format(.Range("G" & j), "HH:MM")
Me.TextBox2.Value = Format(.Range("H" & j), "HH:MM")
ElseIf Weekday(joursj) = 3 Then 'Mardi
Me.TextBox1.Value = Format(.Range("I" & j), "HH:MM")
Me.TextBox2.Value = Format(.Range("J" & j), "HH:MM")
ElseIf Weekday(joursj) = 4 Then 'Mercredi
Me.TextBox1.Value = Format(.Range("K" & j), "HH:MM")
Me.TextBox2.Value = Format(.Range("L" & j), "HH:MM")
ElseIf Weekday(joursj) = 5 Then 'Jeudi
Me.TextBox1.Value = Format(.Range("M" & j), "HH:MM")
Me.TextBox2.Value = Format(.Range("N" & j), "HH:MM")
ElseIf Weekday(joursj) = 6 Then 'Vendredi
Me.TextBox1.Value = Format(.Range("O" & j), "HH:MM")
Me.TextBox2.Value = Format(.Range("P" & j), "HH:MM")
ElseIf Weekday(joursj) = 7 Then 'Samedi
Me.TextBox1.Value = Format(.Range("Q" & j), "HH:MM")
Me.TextBox2.Value = Format(.Range("R" & j), "HH:MM")
ElseIf Weekday(joursj) = 1 Then 'Dimanche
Me.TextBox1.Value = Format(.Range("S" & j), "HH:MM")
Me.TextBox2.Value = Format(.Range("T" & j), "HH:MM")
End If
End If
Next j
End With
End Sub
si je remplace
If Weekday(joursj)
par
If Application.WorksheetFunction.Weekday(joursj)
du coup j'utilise la fonction de la feuille et pas celle de vba mais est ce correct ?