IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Macros et VBA Excel Discussion :

gestion de stock probleme


Sujet :

Macros et VBA Excel

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre actif
    Homme Profil pro
    Inscrit en
    Décembre 2012
    Messages
    30
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Décembre 2012
    Messages : 30
    Par défaut gestion de stock probleme
    Bonsoir a tous,

    Je reviens vers vous j'ai reussi a mettre en place certaine chose mais je pense que mes codes sont un peu lourd, d'ailleur jai aussi certain souci sur des boutons qui ne fonctionne plus pouvez vous m'aider s'il vous plait et vois si je peux l'ameliorer .

    Merci a tous.
    Fichiers attachés Fichiers attachés

  2. #2
    Invité
    Invité(e)
    Par défaut
    Bonjour

    Il serait bon de donner des détails, plutôt qu'une pièce jointe que beaucoup ne pourront ouvrir.

    Ta question c'est un peu : débrouillez vous pour faire fonctionner mon application.

    Philippe

  3. #3
    Membre actif
    Homme Profil pro
    Inscrit en
    Décembre 2012
    Messages
    30
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Décembre 2012
    Messages : 30
    Par défaut excusez moi
    Bonjour , veuillez m'excuser si la facon dont j'ai écrit cela voulais dire debrouillez vous se n'etait pas mon intention.

    En fait je met en place une petite gestion de stock
    je regarde beaucoup votre forum pour apprendre et comprendre mais j'ai toujours un probleme pour supprimer une ligne dans la listbox afin qu'elle puisse s'enlever aussi de mon fichier excel et de meme pour le bouton modifier

    Quand je clique sur ma listbox un textbox est remplit par colonne je me suis dit qu'il serait plus facile de modifier ou supprimer directement par textbox que par listbox qu'en pensez vous? le probleme c'est que tout les codes que je met en place ne fonctionne pas je vous donne mon code pour m'aiguiller merci beaucoup
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    ption Base 1
     
     
     
    Private Sub CommandButton1_Click()
    With Sheets("Clients")
      DerLg = .Range("A" & .Rows.Count).End(xlUp).Row
      .Range("A" & DerLg + 1) = TextBoxfor
      .Range("B" & DerLg + 1) = TextBoxdes
      .Range("C" & DerLg + 1) = ComboBoxcon
      .Range("D" & DerLg + 1) = TextBoxlot
      .Range("E" & DerLg + 1) = TextBoxqua
      .Range("F" & DerLg + 1) = CDate(TextBoxfab)
      .Range("G" & DerLg + 1) = CDate(TextBoxfin)
      .Range("H" & DerLg + 1) = ComboBoxzon
      .Range("I" & DerLg + 1) = TextBoxall
      .Range("J" & DerLg + 1) = TextBoxcom
      .Range("K" & DerLg + 1) = TextBox7
      .Range("L" & DerLg + 1) = TextBox5
      Set plg = .Range("A2:L" & .Range("A" & .Rows.Count).End(xlUp).Row)
      plg.Columns.AutoFit
      Me.Width = ListBox1.Width + 20
      TbEntier = plg
    End With
    End Sub
     
    Private Sub CommandButton2_Click()
    Dim DerLig As Long
      If MsgBox("Voulez vous modifier l'article ?", 36, "Création") = vbYes Then
     
        DerLig = Sheets("Feuil3").Range("A65000").End(xlUp).Row + 1
     
        Range(Cells(DerLig - 1, 1), Cells(DerLig - 1, 40)).Copy
        Cells(DerLig, 1).PasteSpecial Paste:=xlPasteFormats
        Application.CutCopyMode = False
     
     
            Sheets("Feuil3").Cells(DerLig, 1) = TextBoxfor.Value
            Sheets("Feuil3").Cells(DerLig, 2) = TextBoxdes.Value
            Sheets("Feuil3").Cells(DerLig, 3) = ComboBoxcon.Value
            Sheets("Feuil3").Cells(DerLig, 4) = TextBoxlot.Value
            Sheets("Feuil3").Cells(DerLig, 5) = TextBoxqua.Value
            Sheets("Feuil3").Cells(DerLig, 6) = CDate(TextBoxfab.Value)
            Sheets("Feuil3").Cells(DerLig, 7) = CDate(TextBoxfin.Value)
            'Sheets("Feuil3").Cells(DerLig, 8) = ComboBoxzon.Value
            Sheets("Feuil3").Cells(DerLig, 8) = TextBoxall.Value
            Sheets("Feuil3").Cells(DerLig, 9) = ComboBoxlig
            Sheets("Feuil3").Cells(DerLig, 10) = CDate(TextBoxcon.Value)
     
      End If
     
     
     
     
    End Sub
     
    Private Sub CommandButton4_Click()
    Unload Me
    End Sub
     
    Private Sub CommandButton5_Click()
        Me.ListBox1.RemoveItem Me.ListBox1.ListIndex
    End Sub
     
     
     
    Private Sub CommandButton6_Click()
    '
    ' effacer Macro
    ' efface les cellule de la feuille planning
    '
     
    '
        Range("A2:J1519").Select
        Selection.ClearContents
    End Sub
     
    Private Sub Label1_Click()
     
    End Sub
     
    Private Sub TextBoxcom_Change()
     
    End Sub
     
    Private Sub TextBoxrec_Change()
    Dim S As String, i As Long, L As Long, Nbr As Long, k As Long
    Dim tbPartiel()
    nbrecol = 12
    If TextBoxrec = "" Then
      ListBox1.List = TbEntier
    Else
    L = 1
      ReDim Preserve tbPartiel(UBound(TbEntier, 1), nbrecol)
      For i = 1 To UBound(TbEntier, 1)
        For k = 1 To nbrecol
          If UCase(TbEntier(i, k)) Like "*" & UCase(TextBoxrec) & "*" Then
            For Nbr = 1 To 12
              tbPartiel(L, Nbr) = TbEntier(i, Nbr)
            Next Nbr
            L = L + 1
            Exit For
          End If
        Next k
      Next i
      Me.Repaint
      ListBox1.List = tbPartiel
    End If
    End Sub
     
     
     
     
    Private Sub UserForm_Initialize()
    Dim cw
    With Sheets("Clients")
      Set plg = .Range("A2:L" & .Range("A" & .Rows.Count).End(xlUp).Row)
      plg.Columns.AutoFit
      ListBox1.Width = 20 + plg.Width
      Me.Width = ListBox1.Width + 20
      TbEntier = plg
    End With
    With ListBox1
      cw = ""
      .ColumnCount = plg.Columns.Count
      .List = TbEntier
      For i = 1 To .ColumnCount
        cw = cw & plg.Columns(i).Width & ";"
        Next
      .ColumnWidths = cw
      .ListIndex = -1
    End With
     
    ComboBoxcon.Clear
    ComboBoxzon.Clear
    ComboBoxlig.Clear
     
    ComboBoxcon.AddItem "Conforme"
    ComboBoxcon.AddItem "Non-Conforme"
    ComboBoxcon.AddItem "En Attente"
     
    ComboBoxzon.AddItem "Conforme"
    ComboBoxzon.AddItem "Non-Conforme"
    ComboBoxzon.AddItem "Preparation"
    ComboBoxzon.AddItem "Controle"
    ComboBoxzon.AddItem "Recontrole"
     
    ComboBoxlig.AddItem "Ratio 1"
    ComboBoxlig.AddItem "Ratio 2"
    ComboBoxlig.AddItem "Ratio 3"
    ComboBoxlig.AddItem "Ratio 4"
    ComboBoxlig.AddItem "Ratio 5"
    ComboBoxlig.AddItem "Ratio 6"
    ComboBoxlig.AddItem "MLB"
    ComboBoxlig.AddItem "KALIX"
    ComboBoxlig.AddItem "Stoppil 3"
    ComboBoxlig.AddItem "Stoppil 4"
    ComboBoxlig.AddItem "Serac 2"
    ComboBoxlig.AddItem "Serac 3"
    ComboBoxlig.AddItem "Stoppil 2"
     
    End Sub
     
    Sub ListBox1_Click()
     
    Dim i As Integer
     
    i = ListBox1.ListIndex
    Row = ListBox1.ListIndex + 2
     
    TextBoxfor.Text = ListBox1.List(i, 0)
    TextBoxdes.Text = ListBox1.List(i, 1)
    ComboBoxcon.Text = ListBox1.List(i, 2)
    TextBoxlot.Text = ListBox1.List(i, 3)
    TextBoxqua.Text = ListBox1.List(i, 4)
    TextBoxfab.Text = CDate(ListBox1.List(i, 5))
    TextBoxfin.Text = CDate(ListBox1.List(i, 6))
    ComboBoxzon.Text = ListBox1.List(i, 7)
    TextBoxall.Text = ListBox1.List(i, 8)
    TextBoxcom.Text = ListBox1.List(i, 9)
     
    End Sub
    De plus quand je vois les codes que vous donnez parfois je penses que le mien doit etre lourd, qu'en pensez vous ??

  4. #4
    Membre éprouvé
    Homme Profil pro
    Assistant aux utilisateurs
    Inscrit en
    Septembre 2007
    Messages
    1 896
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 64
    Localisation : France

    Informations professionnelles :
    Activité : Assistant aux utilisateurs
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Septembre 2007
    Messages : 1 896
    Par défaut
    Bonjour,

    Vous avez un bug sur cette ligne car vous avez un format date alors que dans la colonne est inscrit "FUT" mais non une date.

    Je me suis arrêté là pour le moment

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Sheets("Feuil3").Cells(DerLig, 7) = CDate(TextBoxfin.Value)

  5. #5
    Membre actif
    Homme Profil pro
    Inscrit en
    Décembre 2012
    Messages
    30
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Décembre 2012
    Messages : 30
    Par défaut
    Merci beaucoup , deja 1ere erreur je rectifie

    C'est vrai que j'ai recupere une base de donne mais je pense qu'il doit y avoir des erreurs, moi je ne suis pas un maitre en vba mais j'essaie et se n'est pas tres facile ( d'ailleur si vous pouviez me conseiller un livre en meme temps sa serai genial). Pour l'erreur sur le tableau elle est rectifier merci encore

    personne n'a d'idée sur mon problème juste une direction a me donner
    pour la suppression j'ai lu que quand on avait une listbox avec additem on pouvait utiliser remove item mais ca ne marche pas chez moi

Discussions similaires

  1. Réponses: 14
    Dernier message: 20/05/2012, 16h55
  2. un probleme dans une application de gestion de stock
    Par dimainfo dans le forum Langage
    Réponses: 1
    Dernier message: 23/07/2007, 09h41
  3. probleme lier a un gestion de stock
    Par magicaos dans le forum Access
    Réponses: 1
    Dernier message: 02/02/2006, 18h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo