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
| Option Explicit
Sub larecherche()
Dim question As String
If MsgBox("Êtes-vous sûr ?", 36, "Confirmation") = vbNo Then Exit Sub
question = InputBox("Encodage pour solder un acompte" & vbCrLf & vbCrLf & _
"Numéro de la Facture d'acompte ?", "De l'Habitat ô Jardin")
Dim derlign As Integer
Dim num As String
Dim encode As String
Dim ledevis As String
On Error Resume Next
With Worksheets("Facturier")
derlign = .Cells(.Rows.Count, 1).End(xlUp).Row
num0 = Application.WorksheetFunction.Match(question, .Range("CB1:CB" & derlign), 0)
If Err > 0 Then
MsgBox "Encodage non trouvé"
Exit Sub
End If
num = Application.WorksheetFunction.Index(.Range("A1", .Cells(derlign, 81)), num0, 80)
End With
encode = "Solde de la Facture d'acompte N° " & question
With Worksheets("devis")
derlign = .Cells(.Rows.Count, 1).End(xlUp).Row
dev0 = Application.WorksheetFunction.Match(num, .Range("BU1:BU" & derlign), 0)
If Err > 0 Then
MsgBox "Devis non trouvé"
Exit Sub
End If
ledevis = "Commande pour un montant total de : " & Application.WorksheetFunction.Index(.Range("A1", .Cells(derlign, 81)), dev0, 80) & " TVAC"
End With
On Error GoTo 0
End Sub |
Partager