bonjour je travail sur une application vba excel mais j’ai un souci je veux pouvoir mettre la valeur de la cellule G35 de ma feuille" facturation" dans la cellule D de la feuille “D6”
Private Sub ajouter_Click()
Dim ligne As Integer: ligne = 2
Dim lignef As Integer: lignef = 6
If (ref.SelText <> “”) Then
If (IsNumeric(quantite.Value) = False) Then
MsgBox (“La quantité saisie n’est pas un nombre, veuillez corriger”)
Exit Sub
Else
While (ThisWorkbook.Worksheets(“articles”).Cells(ligne, 3).Value <> “”)
If (ThisWorkbook.Worksheets(“articles”).Cells(ligne, 3).Value = ref.SelText) Then
If (Int(quantite.Value) > Int(ThisWorkbook.Worksheets(“articles”).Cells(ligne, 6).Value)) Then
MsgBox "La quantité en stock pour cette référence n’est que de " & ThisWorkbook.Worksheets(“articles”).Cells(ligne, 6).Value
Exit Sub
Else
While (ThisWorkbook.Worksheets(“facturation”).Cells(lignef, 3).Value <> “”)
lignef = lignef + 1
Wend
ThisWorkbook.Worksheets(“facturation”).Cells(lignef, 3).Value = ref.SelText
ThisWorkbook.Worksheets(“facturation”).Cells(lignef, 5).Value = quantite.Value
End If
End If
ligne = ligne + 1
Wend
End If
End If
ligne = ligne + 1
End Sub
Sub CopyRange()
Worksheets(“facturation”).Range(“G35”).Copy Worksheets(“BDD”).Range(“D6”)
End Sub
Sub rangecopy()
ligne = Sheets(“BDD”).Range(“C2”).End(xlDown).Row + 1
Sheets(“BDD”).Range(“C” & ligne).Value = Sheets(“Facturation”).Range(“G32”).Value
Sheets("Facturation").Range("G6:G26").ClearContents
Sheets("Facturation").Range("G6").Value = Sheets("Facturation").Range("G6").Value + 1
End Sub
Sub CopyRange()
Dim SourceRange As Range
Dim DestinationRange As Range
Set SourceRange = Worksheets(“facturation”).Range(“G35”)
Set DestinationRange = Worksheets(“BDD”).Range(“D6”)
SourceRange.Copy DestinationRange
End Sub
Private Sub BDD_Click()
Worksheets(“facturation”).Range(“G35”).Value = Worksheets(“BDD”).Range(“G6”).Value
End Sub
Private Sub CommandButton1_Click()
End Sub
Private Sub REINITIALISER_Click()
ThisWorkbook.Worksheets(“facturation”).Activate
Range(“C6:C26”).Value = “”
Range(“E6:E26”).Value = “”
End Sub
Private Sub DEVIS_Activate()
Dim ligne As Integer: ligne = 2
While ThisWorkbook.Worksheets(“articles”).Cells(ligne, 3).Value <> “”
ref.AddItem (ThisWorkbook.Worksheets(“articles”).Cells(ligne, 3).Value)
ligne = ligne + 1
Wend
ThisWorkbook.Worksheets(“facturation”).Activate
End Sub
Private Sub VALIDER_Click()
Dim reponse As Byte
Dim ligne As Integer: ligne = 2
Dim lignef As Integer: lignef = 6
reponse = MsgBox(“Souhaitez-vous valider la facture et mettre à jour les stocks”, vbYesNo + vbQuestion)
If (reponse = 6) Then
While (ThisWorkbook.Worksheets(“facturation”).Cells(lignef, 3).Value <> “”)
ligne = 2
While (ThisWorkbook.Worksheets(“articles”).Cells(ligne, 3).Value <> “”)
If (ThisWorkbook.Worksheets(“facturation”).Cells(lignef, 3) = ThisWorkbook.Worksheets(“articles”).Cells(ligne, 3).Value) Then
ThisWorkbook.Worksheets(“articles”).Cells(ligne, 6).Value = ThisWorkbook.Worksheets(“articles”).Cells(ligne, 6).Value - ThisWorkbook.Worksheets(“facturation”).Cells(lignef, 5)
End If
ligne = ligne + 1
Wend
lignef = lignef + 1
Wend
End If
If MsgBox(“confirmez-vous l’ajout des données?”, vbYesNo, “confirmation”) = vbYes Then
Worksheets(“BDD”).Select
ligne = Sheets(“BDD”).Range(“C2”).End(xlUp).Row + 1
End If
Label1.Caption = “Les stocks ont été mis jour. La facture VALIDER”
End SubLOGI.xlsm (58,5 Ko)