rudy dehaudt
XLDnaute Occasionnel
bonsoir a tous,
pour éviter de recréer un bouton j aurai souhaiter inclure le code 2 dans le code 1
explication de code1 :
il renvoye des informations divers dans une feuille précise puis fait disparaitre le boutons
explication du code2 :
il extrait le nom de l onglets et le recopie en E1 de la feuille active
code1
Private Sub CommandButton1_Click()
Dim Lg As Long
Dim tva As Single
With Sheets("Data").Range("A:A")
For n = 2 To .Range("A65536").End(xlUp).Row
t = InStr(Me.Range("G6"), .Cells(n, 1).Value) > 0
If t Then
tva = .Cells(n, 2)
Exit For
End If
Next
End With
With Sheets("Suivi de BL et FACTURE ")
Lg = .Range("B65536").End(xlUp).Row + 1
.Cells(Lg, 2) = Me.Range("G1") ' Date Cde
.Cells(Lg, 3) = Me.Range("G6") ' Fournisseur
.Cells(Lg, 4) = Me.Range("D7") ' Date Livraison
.Cells(Lg, 5) = Me.Range("E1") ' N° Bon de Commande
' .Cells(Lg, 6) = Me.Range("") ' N° BL
' .Cells(Lg, 7) = Me.Range("") ' N° Facture
' .Cells(Lg, 8) = Me.Range("G1") ' Montant HT
' .Cells(Lg, 9) = tva
' .Cells(Lg, 12) = Me.Range("") ' Statut Livraison
End With
Me.CommandButton1.Visible = False
End Sub
code 2
Sub test2()
[E1] = ActiveSheet.Name
End Sub
d'avance merci du coup de main
A+
pour éviter de recréer un bouton j aurai souhaiter inclure le code 2 dans le code 1
explication de code1 :
il renvoye des informations divers dans une feuille précise puis fait disparaitre le boutons
explication du code2 :
il extrait le nom de l onglets et le recopie en E1 de la feuille active
code1
Private Sub CommandButton1_Click()
Dim Lg As Long
Dim tva As Single
With Sheets("Data").Range("A:A")
For n = 2 To .Range("A65536").End(xlUp).Row
t = InStr(Me.Range("G6"), .Cells(n, 1).Value) > 0
If t Then
tva = .Cells(n, 2)
Exit For
End If
Next
End With
With Sheets("Suivi de BL et FACTURE ")
Lg = .Range("B65536").End(xlUp).Row + 1
.Cells(Lg, 2) = Me.Range("G1") ' Date Cde
.Cells(Lg, 3) = Me.Range("G6") ' Fournisseur
.Cells(Lg, 4) = Me.Range("D7") ' Date Livraison
.Cells(Lg, 5) = Me.Range("E1") ' N° Bon de Commande
' .Cells(Lg, 6) = Me.Range("") ' N° BL
' .Cells(Lg, 7) = Me.Range("") ' N° Facture
' .Cells(Lg, 8) = Me.Range("G1") ' Montant HT
' .Cells(Lg, 9) = tva
' .Cells(Lg, 12) = Me.Range("") ' Statut Livraison
End With
Me.CommandButton1.Visible = False
End Sub
code 2
Sub test2()
[E1] = ActiveSheet.Name
End Sub
d'avance merci du coup de main
A+