Microsoft 365 Modifier saisie via userform [ABANDON]

romubzh35

XLDnaute Occasionnel
Bonjour à toutes et à tous
je suis la fiabilité de nos batteries mais je n'arrive pas à modifier ma ligne, je créé à chaque saisie une nouvelle ligne
dans l'onglet "Saisie" en cliquant sur le bouton "Nouvelle saisie" je viens tous les mois noter le numéro de la machine et la valeur de charge des batteries
exemple ligne 58, en janvier la batterie XX01 etait sur l'agv 633 et avait une valeur de 63 %, et février l'agv 634 et 56 %
donc en cliquant sur nouvelle saisie je choisis via la combobox la batterie sur laquelle je veux noter mes informations, et je charge les textbox et combobox mais à chaque fois que je valide cela me créé une nouvelle ligne..
comment faire pour que cela ne créé pas de nouvelles lignes mais que les informations viennent à la suite.
par exemple pour la ligne 58 en mars les valeurs viennent en H58 et I58 au lieu de créer une ligne 59
pourriez vous m'expliquer afin que je sois autonome par la suite
merci de votre aide
 

Pièces jointes

  • Suivi chargement batterie 01 02 2023 - Copie.xlsm
    408.1 KB · Affichages: 4

romubzh35

XLDnaute Occasionnel
bonjour
il y a un code qui permet d'envoyer un mail en interne lorsque le technicien pense qu'il faut prévenir vu l'état des batteries.
que puis je faire pour que vous puissiez ouvrir le fichier tranquillement ?
le code que j'ai pour remplir le userform et recharger les infos est le suivant

VB:
Private Sub CommandButton1_Click()
Dim derligne As Integer
If MsgBox("Confirmez-vous l'Ajout des Données ?", vbYesNo, "confirmation") = vbYes Then

derligne = Sheets("Saisie").Range("A254256").End(xlUp).Row + 1

Cells(derligne, 1) = ComboBox1.Value
Cells(derligne, 3) = TextBox1.Value
Cells(derligne, 4) = ComboBox3.Value
Cells(derligne, 5) = TextBox2.Value
Cells(derligne, 6) = ComboBox4.Value
Cells(derligne, 7) = TextBox3.Value
Cells(derligne, 8) = ComboBox5.Value
Cells(derligne, 9) = TextBox4.Value
Cells(derligne, 10) = ComboBox6.Value
Cells(derligne, 11) = TextBox5.Value
Cells(derligne, 12) = ComboBox7.Value
Cells(derligne, 13) = TextBox6.Value
Cells(derligne, 14) = ComboBox8.Value
Cells(derligne, 15) = TextBox7.Value
Cells(derligne, 16) = ComboBox9.Value
Cells(derligne, 17) = TextBox15.Value
Cells(derligne, 18) = ComboBox10.Value
Cells(derligne, 19) = TextBox9.Value
Cells(derligne, 20) = ComboBox11.Value
Cells(derligne, 21) = TextBox10.Value
Cells(derligne, 22) = ComboBox12.Value
Cells(derligne, 23) = TextBox11.Value
Cells(derligne, 24) = ComboBox13.Value
Cells(derligne, 25) = TextBox12.Value
Cells(derligne, 26) = ComboBox14.Value
Cells(derligne, 27) = TextBox13.Value
End If
Unload Me
End Sub


Private Sub CommandButton2_Click()
Unload Me
End Sub

Private Sub Frame1_Click()

End Sub

Private Sub OptionButton1_Click()

    Dim oOutlook As Object
    Set oOutlook = CreateObject("Outlook.Application")
  
    Dim oMail As Object
    Set oMail = oOutlook.CreateItem(0)
  
    With oMail
    Dim oObjetWord As Object
    Set oObjetWord = .GetInspector.WordEditor
  
         Application.EnableEvents = Fals
        .To = "coucou@coucou.com"
        .Subject = "Mail automatique : " & ThisWorkbook.Name
         Range("AB10:AM23").Select
         Range("AB10:AM23").Copy
        oObjetWord.Range(0).Paste
        '.Send
        .Display
        .Save
        .Send
        Application.CutCopyMode = False
        Range("A2").Select
        ActiveWindow.ScrollRow = Selection.Row
        ActiveWindow.ScrollColumn = Selection.Column
        Application.EnableEvents = True
    End With
  
End Sub


Private Sub TextBox14_Change()
End Sub

Private Sub TextBox2_Change()

End Sub

Private Sub TextBox3_Change()

End Sub

Private Sub UserForm_Initialize()
TextBox1.Value = Format(Now, "dd/mm/yyyy")

End Sub

Private Sub ComboBox1_Change()
With ThisWorkbook.Sheets("Saisie")
For Each Nom In .Range("A3:A1000" & .[A65000].End(xlUp).Row)
If CStr(Nom) = CStr(Me.ComboBox1.Value) Then
Me.TextBox2.Value = .Cells(Nom.Row, 5)
Me.TextBox3.Value = .Cells(Nom.Row, 7)
Me.TextBox4.Value = .Cells(Nom.Row, 9)
Me.TextBox5.Value = .Cells(Nom.Row, 11)
Me.TextBox6.Value = .Cells(Nom.Row, 13)
Me.TextBox7.Value = .Cells(Nom.Row, 15)
Me.TextBox15.Value = .Cells(Nom.Row, 17)
Me.TextBox9.Value = .Cells(Nom.Row, 19)
Me.TextBox10.Value = .Cells(Nom.Row, 21)
Me.TextBox11.Value = .Cells(Nom.Row, 23)
Me.TextBox12.Value = .Cells(Nom.Row, 25)
Me.TextBox13.Value = .Cells(Nom.Row, 27)
Me.TextBox14.Value = .Cells(Nom.Row, 29)

Me.ComboBox3.Value = .Cells(Nom.Row, 4)
Me.ComboBox4.Value = .Cells(Nom.Row, 6)
Me.ComboBox5.Value = .Cells(Nom.Row, 8)
Me.ComboBox6.Value = .Cells(Nom.Row, 10)
Me.ComboBox7.Value = .Cells(Nom.Row, 12)
Me.ComboBox8.Value = .Cells(Nom.Row, 14)
Me.ComboBox9.Value = .Cells(Nom.Row, 16)
Me.ComboBox10.Value = .Cells(Nom.Row, 18)
Me.ComboBox11.Value = .Cells(Nom.Row, 20)
Me.ComboBox12.Value = .Cells(Nom.Row, 22)
Me.ComboBox13.Value = .Cells(Nom.Row, 24)
Me.ComboBox14.Value = .Cells(Nom.Row, 26)
End If
Next
End With
End Sub
 
Dernière édition:

Discussions similaires

Statistiques des forums

Discussions
312 088
Messages
2 085 203
Membres
102 818
dernier inscrit
NeoMaint