Bonjour à tous, et merci d'avance pour votre aide !
Depuis peu, cette erreur m'est apparu et je ne parviens pas à trouver d'où elle vient... Le message d'erreur indique la ligne 9 :
nomachi = Feuil2.Cells(x, 1)
Si vous avez une petite idée je suis preneur !
Ci-joint le code.
Public Sub calends()
Dim x As Long, Y As Long, gg As Integer, t As Byte
Dim nomachi As Integer
Dim comme As String
Dim dat As Date
Dim per, perr
Dim moyen As Double
For x = 2 To finf2
nomachi = Feuil2.Cells(x, 1)
moyen = xmoy(nomachi): If moyen = 0 Then moyen = 1
For Y = 2 To finf1
If Feuil1.Cells(Y, 1) = nomachi Then
If (xmaint3(Feuil1.Cells(Y, 2)) = False And IsDate(Feuil1.Cells(Y, 5)) = True) Or xmaint3(Feuil1.Cells(Y, 2)) = True Then
If filtr = 0 Or filtr = Feuil1.Cells(Y, 12) Then
If xmaint3(Feuil1.Cells(Y, 2)) = False Then dat = Feuil1.Cells(Y, 5) Else dat = DateAdd("d", Int(Feuil1.Cells(Y, 4) / xmoy(nomachi)), Feuil1.Cells(Y, 3))
If (Left(Feuil1.Cells(Y, 4), 1) = "d" Or Left(Feuil1.Cells(Y, 4), 1) = "m") And UserForm7.CheckBox3 = True Then per = Val(Mid(Feuil1.Cells(Y, 4), 2)): perr = Left(Feuil1.Cells(Y, 4), 1) Else per = "": perr = ""
Do
If dat >= debutcalend And dat <= fincalend Then
gg = DateDiff("d", debutcalend, dat) + 2
If Weekday(dat, vbSaturday) < 3 And nosam = True Then gg = gg + 3 - Weekday(dat, vbSaturday)
comme = xmach(nomachi):
If organ = True Then comme = comme + Chr(10) + xmaint1(Feuil1.Cells(Y, 2)) + Chr(10) + xmaint2(Feuil1.Cells(Y, 2))
If interv = True Then comme = comme + Chr(10) + xinter(Feuil1.Cells(Y, 12))
For t = 2 To 200
If Feuil10.Cells(gg, t) = "" Then Feuil10.Cells(gg, t) = comme: Exit For
Next
End If
If perr <> "" Then dat = DateAdd(perr, per, dat)
If perr = "" Or dat > fincalend Then Exit Do Else
Loop
End If
End If
End If
Next
Next
End Sub