Macro sur un fichier
Bonjour a tous,
je clos mon précédent sujet:
https://forum.excel-pratique.com/viewtopic.php?f=2&t=141586&p=869342#p869342
je remercie M12 d'avoir su apporté les réponses
Pour en ouvrir un autre plus complexe
ce que je souhaite faire c'est une macro avec un bouton de déclenchement
qui applique les formule qui ce trouve en :
- D8 il y a une coquille a l'heure actuelle car ma variable est fixé au lieux indexé sur le numéro de semaine
- E8 formule qui est bonne
sur X colonne x étant défini par la variable qui ce trouve dans C3
en espérant avoir suffisamment développé mon besoin
Merci de votre attention
j'ai un code VBA mais je suis pas sur d'arrivé a adapté le besoin
Sub remplissage_x10()
Dim s_formule As String
Dim l_pos As Long
Dim l_fin As Long
Dim l_col As Long
Dim cptevide As Integer
Dim s_nom As String
If MsgBox("Voulez-vous poursuivre ?", vbOKCancel) = vbCancel Then Exit Sub
vireespaces
virelignesvides
s_nom = ActiveSheet.Name
Sheets("Capacités & Congés").Select
Range("AC3").Select
ActiveSheet.PivotTables("Tableau croisé dynamique1").ClearAllFilters
Sheets(s_nom).Activate
l_col = 24
Application.Calculation = xlManual
While l_col < 34
l_pos = 10
cptevide = 0
While l_pos < 7000 And cptevide < 3
If Range("D" & l_pos).Value = "Disponibilité" Then
l_fin = 0
While Range("D" & l_pos + l_fin).Value <> ""
l_fin = l_fin + 1
Wend
Cells(l_pos, l_col).FormulaR1C1 = "=VLOOKUP(RC3,'Capacités & Congés'!R2C1:R501C13,13,FALSE)-SUM(R[1]C:R[" & l_fin & "]C)-IFERROR(VLOOKUP(RC3&R9C[-19],'Capacités & Congés'!R2C28:R30001C31,4,FALSE)*7.6,0)"
cptevide = 0
End If
If Range("D" & l_pos).Value = "" Then
Cells(l_pos, l_col).Value = Cells(9, l_col - 19).Value
cptevide = cptevide + 1
End If
If Left(Range("D" & l_pos).Value, 8) = "Planning" Then
Cells(l_pos, l_col).Value = Cells(l_pos, l_col - 19).Value
cptevide = 0
End If
l_pos = l_pos + 1
If l_pos = 350 Then
l_pos = 350
End If
Wend
l_col = l_col + 1
Wend
l_fin = Range("A7000").End(xlUp).Row
Rows(l_fin + 1 & ":" & l_fin + 5).Delete
Application.Calculation = xlAutomatic
End Sub