Created
December 6, 2016 12:55
-
-
Save cyrilferte/fe3e755f3bb04d243e9f718bd38a4e38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Macroincertion() | |
' | |
' Macro d'ajout de cell | |
' | |
Dim groupCheck As String 'lettre du lot de travaux | |
Dim i As Integer | |
For i = 1 To 100 | |
If Worksheets("Planning container").Range("A" & i).Value = "B" Then | |
lotBinit = i | |
End If | |
If Worksheets("Planning container").Range("A" & i).Value = "C" Then | |
lotCinit = i | |
End If | |
If Worksheets("Planning container").Range("A" & i).Value = "D" Then | |
lotDinit = i | |
End If | |
If Worksheets("Planning container").Range("A" & i).Value = "E" Then | |
lotEinit = i | |
End If | |
If Worksheets("Planning container").Range("A" & i).Value = "F" Then | |
lotFinit = i | |
End If | |
If Worksheets("Planning container").Range("A" & i).Value = "G" Then | |
lotGinit = i | |
End If | |
Next | |
logGend = Worksheets("Planning container").Cells(Worksheets("Planning container").Rows.Count, "A").End(xlUp).Row | |
MsgBox (logGend) | |
'end loop i | |
groupNewTache = InputBox("lot de travaux ? (A, B, C...)", "ajout de tache") | |
nomNewTache = InputBox("nom de la nouvelle tache", "ajout de tache") | |
If groupNewTache = "A" Then | |
Rows(lotBinit - 1).Insert | |
rowWrite = lotBinit - 2 | |
Worksheets("Planning container").Range("B" & rowWrite).Value = nomNewTache | |
Worksheets("Détail des tâches").Range("B" & rowWrite).Value = nomNewTache | |
ElseIf groupNewTache = "B" Then | |
Rows(lotCinit - 1).Insert | |
rowWrite = lotCinit - 2 | |
Worksheets("Planning container").Range("B" & rowWrite).Value = nomNewTache | |
Worksheets("Détail des tâches").Range("B" & rowWrite).Value = nomNewTache | |
ElseIf groupNewTache = "C" Then | |
Rows(lotDinit - 1).Insert | |
rowWrite = lotDinit - 2 | |
Worksheets("Planning container").Range("B" & rowWrite).Value = nomNewTache | |
Worksheets("Détail des tâches").Range("B" & rowWrite).Value = nomNewTache | |
ElseIf groupNewTache = "D" Then | |
Rows(lotEinit - 1).Insert | |
rowWrite = lotEinit - 2 | |
Worksheets("Planning container").Range("B" & rowWrite).Value = nomNewTache | |
Worksheets("Détail des tâches").Range("B" & rowWrite).Value = nomNewTache | |
ElseIf groupNewTache = "E" Then | |
Rows(lotFinit - 1).Insert | |
rowWrite = lotFinit - 2 | |
Worksheets("Planning container").Range("B" & rowWrite).Value = nomNewTache | |
Worksheets("Détail des tâches").Range("B" & rowWrite).Value = nomNewTache | |
ElseIf groupNewTache = "F" Then | |
Rows(lotGinit - 1).Insert | |
rowWrite = lotGinit - 2 | |
Worksheets("Planning container").Range("B" & rowWrite).Value = nomNewTache | |
Worksheets("Détail des tâches").Range("B" & rowWrite).Value = nomNewTache | |
ElseIf groupNewTache = "G" Then | |
Worksheets("Planning container").Range("B" & lotGend).Value = nomNewTache | |
Worksheets("Détail des tâches").Range("B" & rowWrite).Value = nomNewTache | |
Else | |
MsgBox ("mauvais nom de lot de travail") | |
End If | |
nomNewTache = InputBox("nom de la nouvelle tache", "ajout de tache") | |
MsgBox (nomNewTache) | |
endOutils = False | |
While endOutils = False | |
addOutil = InputBox("nom de l'outil", "ajout d'outils") | |
nbOutil = InputBox("quantité ?", "ajout d'outils") | |
jOutil = InputBox("jour d'utilisation ?", "ajout d'outils") | |
jAproOutil = InputBox("jour d'aprovissionnement ?", "ajout d'outils") | |
lColumn = ws.Cells(rowWrite, Columns.Count).End(xlToLeft).Column | |
Worksheets("Détail des tâches").Range(lColumn & rowWrite).Value= addOutil | |
endInputOutils = InputBox("ajouter un autre outil ? (oui ou non)", "ajout de tache") | |
If endInputOutils = "non" Then | |
endOutils = True | |
End If | |
Wend | |
'ajout nom de tache | |
'planning B. OK | |
'semaine B | |
'detail outil OK | |
'addoutil | |
'semaine b | |
'detail e to infinite | |
'nbOutil | |
'semaine C | |
'jOutil | |
'planning B | |
'semaine B | |
'detail outil | |
'jAproOutil | |
'planning B | |
'semaine B | |
'detail outil | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sub Macroincertion()
'
' Macro d'ajout de cell
'
Dim groupCheck As String 'lettre du lot de travaux
Dim i As Integer
For i = 1 To 100
If Worksheets("Planning container").Range("A" & i).Value = "B" Then
Next
logGend = Worksheets("Planning container").Cells(Worksheets("Planning container").Rows.Count, "A").End(xlUp).Row
MsgBox (logGend)
For i = 1 To 1000
If Worksheets("Pieces semaine 1").Range("A" & i).Value = "B" Then
Next
For i = 1 To 1000
If Worksheets("Pieces semaine 2").Range("A" & i).Value = "B" Then
Next
For i = 1 To 1000
If Worksheets("Pieces semaine 3").Range("A" & i).Value = "B" Then
Next
For i = 1 To 1000
If Worksheets("Pieces semaine 4").Range("A" & i).Value = "B" Then
Next
'end loop i
groupNewTache = InputBox("lot de travaux ? (A, B, C...)", "ajout de tache")
nomNewTache = InputBox("nom de la nouvelle tache", "ajout de tache")
refTache = InputBox("reference tache", "ajout de tache")
If groupNewTache = "A" Then
Worksheets("Planning container").Rows(lotBinit - 1).Insert
Worksheets("Detail des taches").Rows(lotBinit - 1).Insert
rowWrite = lotBinit - 2
Worksheets("Planning container").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Detail des taches").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Planning container").Range("A" & rowWrite + 1).Value = refTache
Worksheets("Detail des taches").Range("A" & rowWrite + 1).Value = refTache
ElseIf groupNewTache = "B" Then
Worksheets("Planning container").Rows(lotCinit - 1).Insert
Worksheets("Detail des taches").Rows(lotCinit - 1).Insert
rowWrite = lotCinit - 2
Worksheets("Planning container").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Detail des taches").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Planning container").Range("A" & rowWrite + 1).Value = refTache
Worksheets("Detail des taches").Range("A" & rowWrite + 1).Value = refTache
ElseIf groupNewTache = "C" Then
Worksheets("Planning container").Rows(lotDinit - 1).Insert
Worksheets("Detail des taches").Rows(lotDinit - 1).Insert
rowWrite = lotDinit - 2
Worksheets("Planning container").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Detail des taches").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Planning container").Range("A" & rowWrite + 1).Value = refTache
Worksheets("Detail des taches").Range("A" & rowWrite + 1).Value = refTache
ElseIf groupNewTache = "D" Then
Worksheets("Planning container").Rows(lotEinit - 1).Insert
Worksheets("Detail des taches").Rows(lotEinit - 1).Insert
rowWrite = lotEinit - 2
Worksheets("Planning container").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Detail des taches").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Planning container").Range("A" & rowWrite + 1).Value = refTache
Worksheets("Detail des taches").Range("A" & rowWrite + 1).Value = refTache
ElseIf groupNewTache = "E" Then
Worksheets("Planning container").Rows(lotFinit - 1).Insert
Worksheets("Detail des taches").Rows(lotFinit - 1).Insert
rowWrite = lotFinit - 2
Worksheets("Planning container").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Detail des taches").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Planning container").Range("A" & rowWrite + 1).Value = refTache
Worksheets("Detail des taches").Range("A" & rowWrite + 1).Value = refTache
ElseIf groupNewTache = "F" Then
Worksheets("Planning container").Rows(lotGinit - 1).Insert
Worksheets("Detail des taches").Rows(lotGinit - 1).Insert
rowWrite = lotGinit - 2
Worksheets("Planning container").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Detail des taches").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Planning container").Range("A" & rowWrite + 1).Value = refTache
Worksheets("Detail des taches").Range("A" & rowWrite + 1).Value = refTache
ElseIf groupNewTache = "G" Then
Worksheets("Planning container").Range("B" & lotGend).Value = nomNewTache
Worksheets("Detail des taches").Range("B" & rowWrite + 1).Value = nomNewTache
Worksheets("Planning container").Range("A" & rowWrite + 1).Value = refTache
Worksheets("Detail des taches").Range("A" & rowWrite + 1).Value = refTache
Else
MsgBox ("mauvais nom de lot de travail")
End If
endOutils = False
tacheInsert = False
nbDiffOutils = 0
While endOutils = False
'gestion des semaine
If jAproOutil <= 5 Then
ElseIf jAproOutil >= 6 And jAproOutil <= 10 Then
ElseIf jAproOutil >= 11 And jAproOutil <= 15 Then
ElseIf jAproOutil >= 16 And jAproOutil <= 20 Then
Else
MsgBox ("mauvaise semaine")
End If
Wend
'ajout nom de tache
'planning B. OK
'semaine B
'detail outil OK
'addoutil
'semaine b
'detail e to infinite
'nbOutil
'semaine C
'jOutil
'planning B
'semaine B
'detail outil
'jAproOutil
'planning B
'semaine B
'detail outil
End Sub