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
| Public Fl As Worksheet, Flcd As Worksheet, Flech As Worksheet
Public nlig As Integer, lNx As Integer, col As Integer
Public rancom As Range, randes As Integer
Public satisf As Boolean, ligdebut As Integer, ligfin As Integer, lxnech As Integer
Public cib1 As String, cib2 As String
Public rcib1 As Range, rcib2 As Range
Public valtb1 As String, valtb2 As String, valtb3 As String, valtb4 As String
Public valtb5 As String, cbo1 As String, cbo2 As String, cbo3 As String
Public celdevis As Integer, montplage As Range, celmont As Range, xlig As Integer
Public ndevis As String, nclient As String, npalet As Integer, ndate As Date
Public xndev As Integer, montantp As Byte
Sub copieclient()
Set Flcd = ThisWorkbook.Worksheets("CC2012")
Set Fl = ThisWorkbook.Worksheets("facturation prévisionnelle")
Set Flech = ThisWorkbook.Worksheets("Echéancier")
Set rancom = Application.InputBox("Sélectionnez une plage !", "Sélection de cellules", Type:=8)
If Not rancom Is Nothing Then
lNx = rancom.Row
Fl.Activate
Range("A1").Select
If Range("A2").Value <> "" Then ActiveCell.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
randes = ActiveCell.Row
ActiveCell.Offset(0, 1).Value = Flcd.Cells(lNx, 8) 'Nom du client
ActiveCell.Offset(0, 2).Value = rancom.Value 'Numéro de commande
ActiveCell.Offset(0, 3).Value = Flcd.Cells(lNx, 9) 'Nom du chantier
ActiveCell.Offset(0, 4).Value = Flcd.Cells(lNx, 5) 'statut(en cours/soldé)
ActiveCell.Offset(0, 5).Value = "=TODAY()" 'Date
Flcd.Cells(lNx, 1).Copy Fl.Cells(randes, 1) 'Numéro de Devis
U_Fact.Show
If satisf = True Then
Fl.Cells(randes, 7).Value = valtb1 'Numéro de Bon
Fl.Cells(randes, 9).Value = valtb2 'Numéro de palette
Fl.Cells(randes, 10).Value = valtb3 'Nombre de pierre
Fl.Cells(randes, 8).Value = valtb4 'Montant Hors taxe
Fl.Cells(randes, 11).Value = valtb5 'Versement
Fl.Cells(randes, 12).Value = cbo1 'Chèque ou espèce
Fl.Cells(randes, 13).Value = cbo2 'statut complete /partielle
Fl.Cells(randes, 14).Value = cbo3 'Vu par tel/mail/pers.
End If
If satisf = False Then
U_Fact.Hide
Flcd.Activate
End If
End If
Set Flcd = Nothing
Set Fl = Nothing
Set Flech = Nothing
End Sub |
Partager