Problème VBA

picronte

XLDnaute Occasionnel
Bonjour le fil
je suis toujours sur mon fichier
mais je ne trouve pas le code qu'il me faut. j'ai utiliser des IF pour qu'il me recherche le noms exacte " cela fonctionne, mais j'ai utilisé else pour qu'il me mette le reste "PRO.EXT" (PX).
le problème c'est qu'il me met tous dans l'onglet PROD.EXT
Pouvez vous m'aider

ci joint le code
Picronte

Sub transfertdonnees()
Dim datedec As Date
Dim datepre As Date
Dim action As String
Dim sujet As String
Dim ligneS As Integer
Dim ligneX As Integer
Dim ligneC As Integer
Dim ligneJF As Integer
Dim ligneJPB As Integer
Dim lignePX As Integer
Dim ligneM As Integer
Dim ligneF As Integer
Dim lignePH As Integer
Dim ligneL As Integer
Dim LigneD As Integer
Dim ligneFA As Integer
Dim ligneT As Integer
Dim ligneB As Integer
Dim ligneG As Integer
Dim LigneH As Integer
Dim LigneJPL As Integer
Dim ligneFR As Integer
Dim ligneDA As Integer
Dim ligneE As Integer
Dim ligneOL As Integer
Dim ligneJP As Integer
Dim ligneSO As Integer

Dim nomprod As String
Dim numprod As Double
Dim nomtech As String
Dim createur As String
Dim zone As String
Dim numerofiche As Double
Dim ctrl As Control
Dim priority As String
Dim duree As Byte
Dim D As Control

ligneX = Sheets("Fiche").Cells(1, 9)
ligneC = Sheets("fiche").Cells(2, 9)
ligneS = Sheets("Fiche").Cells(3, 9)
ligneJF = Sheets("Fiche").Cells(4, 9)
ligneJPB = Sheets("Fiche").Cells(5, 9)
ligneM = Sheets("Fiche").Cells(6, 9)
ligneF = Sheets("Fiche").Cells(7, 9)
lignePH = Sheets("fiche").Cells(8, 9)
ligneL = Sheets("Fiche").Cells(9, 9)
LigneD = Sheets("Fiche").Cells(10, 9)
ligneSO = Sheets("Fiche").Cells(11, 9)
ligneFA = Sheets("Fiche").Cells(12, 9)
ligneT = Sheets("Fiche").Cells(13, 9)
ligneB = Sheets("fiche").Cells(14, 9)
ligneG = Sheets("Fiche").Cells(15, 9)
LigneH = Sheets("Fiche").Cells(16, 9)
LigneJPL = Sheets("Fiche").Cells(17, 9)
ligneFR = Sheets("Fiche").Cells(18, 9)
ligneDA = Sheets("Fiche").Cells(19, 9)
ligneE = Sheets("fiche").Cells(20, 9)
ligneJP = Sheets("Fiche").Cells(21, 9)
lignePX = Sheets("fiche").Cells(22, 9)
ligneOL = Sheets("Fiche").Cells(23, 9)


For Each D In Frame1.Controls
If D.Value = True Then
duree = D.Caption
End If
Next

datedec = date1
sujet = textsujet
action = textaction
datepre = Now() + duree
numerofiche = choixfiche
priority = nprio
nomprod = Nomprodu
nomtech = Nomtechn
numprod = numeprod
createur = creafiche
zone = ZdC

Sheets("synthese").Cells(ligneS, 1) = numprod
Sheets("synthese").Cells(ligneS, 2) = zone
Sheets("synthese").Cells(ligneS, 3) = datedec
Sheets("synthese").Cells(ligneS, 4) = numerofiche
Sheets("synthese").Cells(ligneS, 5) = createur
Sheets("synthese").Cells(ligneS, 6) = priority
Sheets("synthese").Cells(ligneS, 7) = nomprod
Sheets("synthese").Cells(ligneS, 8) = nomtech
Sheets("synthese").Cells(ligneS, 9) = sujet
Sheets("synthese").Cells(ligneS, 10) = action
Sheets("synthese").Cells(ligneS, 11) = datepre
ligneS = ligneS + 1
Sheets("Fiche").Cells(3, 9) = ligneS

If listutil = "X " Then
Sheets("X ").Cells(ligneX, 1) = zone
Sheets("X).Cells(ligneX, 2) = datedec
Sheets("X. ").Cells(ligneX, 3) = numerofiche
Sheets("X. ").Cells(ligneX, 4) = createur
Sheets("X. ").Cells(ligneX, 5) = priority
Sheets("X. ").Cells(ligneX, 6) = numprod
Sheets("X. ").Cells(ligneX, 7) = nomprod
Sheets("X. ").Cells(ligneX, 8) = nomtech
Sheets("X. ").Cells(ligneX, 9) = sujet
Sheets("X. ").Cells(ligneX, 10) = action
Sheets("X").Cells(ligneX, 11) = datepre
ligneX = ligneX + 1
Sheets("Fiche").Cells(1, 9) = ligneX
End If

If listutil = "C " Then
Sheets("C. ").Cells(ligneC, 1) = zone
Sheets("C . ").Cells(ligneC, 2) = datedec
Sheets("C. ").Cells(ligneC, 3) = numerofiche
Sheets("C. ").Cells(ligneC, 4) = createur
Sheets("C.T").Cells(ligneC, 5) = priority
Sheets("C.").Cells(ligneC, 6) = numprod
Sheets("C.").Cells(ligneC, 7) = nomprod
Sheets("C.").Cells(ligneC, 8) = nomtech
Sheets("C.").Cells(ligneC, 9) = sujet
Sheets("C.").Cells(ligneC, 10) = action
Sheets("C.").Cells(ligneC, 11) = datepre
ligneC = ligneC + 1
Sheets("Fiche").Cells(2, 9) = ligneC
End If

If listutil = "JF." Then
Sheets("JF.").Cells(ligneJF, 1) = zone
Sheets("JF.").Cells(ligneJF, 2) = datedec
Sheets("JF.").Cells(ligneJF, 3) = numerofiche
Sheets("JF.").Cells(ligneJF, 4) = createur
Sheets("JF.").Cells(ligneJF, 5) = priority
Sheets("JF.").Cells(ligneJF, 6) = numprod
Sheets("JF.E").Cells(ligneJF, 7) = nomprod
Sheets("JF.").Cells(ligneJF, 8) = nomtech
Sheets("JF.").Cells(ligneJF, 9) = sujet
Sheets("JF.").Cells(ligneJF, 10) = action
Sheets("JF.").Cells(ligneJF, 11) = datepre
ligneJF = ligneJF + 1
Sheets("Fiche").Cells(4, 9) = ligneJF

End If

If listutil = "JP." Then
Sheets("JP.").Cells(ligneJPB, 1) = zone
Sheets("JP.").Cells(ligneJPB, 2) = datedec
Sheets("JP.").Cells(ligneJPB, 3) = numerofiche
Sheets("JP.").Cells(ligneJPB, 4) = createur
Sheets("JP.").Cells(ligneJPB, 5) = priority
Sheets("JP.").Cells(ligneJPB, 6) = numprod
Sheets("JP.").Cells(ligneJPB, 7) = nomprod
Sheets("JP." ).Cells(ligneJPB, 8) = nomtech
Sheets("JP.").Cells(ligneJPB, 9) = sujet
Sheets("JP.").Cells(ligneJPB, 10) = action
Sheets("JP.").Cells(ligneJPB, 11) = datepre
ligneJPB = ligneJPB + 1
Sheets("Fiche").Cells(5, 9) = ligneJPB

End If


Else
Sheets("PROD.EXT").Cells(lignePX, 1) = zone
Sheets("PROD.EXT").Cells(lignePX, 2) = datedec
Sheets("PROD.EXT").Cells(lignePX, 3) = numerofiche
Sheets("PROD.EXT").Cells(lignePX, 4) = createur
Sheets("PROD.EXT").Cells(lignePX, 5) = priority
Sheets("PROD.EXT").Cells(lignePX, 6) = numprod
Sheets("PROD.EXT").Cells(lignePX, 7) = nomprod
Sheets("PROD.EXT").Cells(lignePX, 8) = nomtech
Sheets("PROD.EXT").Cells(lignePX, 9) = sujet
Sheets("PROD.EXT").Cells(lignePX, 10) = action
Sheets("PROD.EXT").Cells(lignePX, 11) = datepre
lignePX = lignePX + 1
Sheets("Fiche").Cells(22, 9) = lignePX



End If
Call efface
Call affichage
End Sub
 

picronte

XLDnaute Occasionnel
Re : Problème VBA

re,
Ci-joint le fichier
Le fichier fonctionne bien mais je souhaiterai que AAA BBB CCC de l'onglet listeprod vont dans l'onglet Prod.ext quand j'ai fini le tri fiche de l'onglet fiche semaine.
Si cela n'est pas claire ne pas hésiter a me poser des questions
Merci Picronte
 

Pièces jointes

  • essai.xlsm
    194.4 KB · Affichages: 33
  • essai.xlsm
    194.4 KB · Affichages: 45
  • essai.xlsm
    194.4 KB · Affichages: 44

Bebere

XLDnaute Barbatruc
Re : Problème VBA

bonjour Picontre,Camarchepas
tu veux que l'on t'aide,met quelques données dans les feuilles concernées(ex:feuille listprod contient des 0)
et où doivent aller AA,BB,CC(quelle colonne A,B,C,???)
Rowsource n"est pas indiqué pour un userform,pertes de propriétés de l'objet
 

Statistiques des forums

Discussions
312 490
Messages
2 088 882
Membres
103 981
dernier inscrit
vinsalcatraz