Modifier code vba

teckmicro Messages postés 89 Date d'inscription   Statut Membre Dernière intervention   -  
teckmicro Messages postés 89 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

je voudrais supprimer le tri par le Nom !

faut enlever quoi comme Ligne !

et je voudrais que les données saisie s'ajoute a partir de la ligne No 2651 !

Merci beaucoup de votre aide !

2 réponses

  1. teckmicro Messages postés 89 Date d'inscription   Statut Membre Dernière intervention  
     
    ..... suite voici le Code a Modifier

    Option Explicit
    Private Sub ComboBox1_Click()
    Dim i As Byte
    CommandButton3.Visible = True
    CommandButton4.Visible = True
    Label27.Caption = "mode : Modification"
    With ComboBox1
    For i = 1 To 22
    Controls("TextBox" & i) = Sheets("feuil1").Cells(.List(.ListIndex, 1), i)
    Next i
    End With
    End Sub
    Private Sub CommandButton1_Click()
    Dim Dl As Long
    Dim x As Byte
    With Sheets("Feuil1")
    .Activate
    Dl = .Range("A65536").End(xlUp).Row + 1
    For x = 1 To 22
    .Cells(Dl, x).Value = Me.Controls("TextBox" & x).Value
    Next x
    Unload Me
    'tri selon le nom
    .Range("A1").CurrentRegion.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:= _
    xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    DataOption1:=xlSortNormal
    End With
    End Sub
    Private Sub CommandButton2_Click()
    Unload Me
    End Sub
    Private Sub CommandButton3_Click()
    Dim i As Byte
    With ComboBox1
    For i = 1 To 22
    Sheets("feuil1").Cells(.List(.ListIndex, 1), i) = Controls("TextBox" & i)
    Controls("TextBox" & i) = ""
    Next i
    .ListIndex = -1
    End With
    CommandButton3.Visible = False
    CommandButton4.Visible = False
    Label27.Caption = "mode : création"
    initialisecombo
    End Sub
    Private Sub CommandButton4_Click()
    Dim i As Byte
    With ComboBox1
    For i = 1 To 22
    Controls("TextBox" & i) = ""
    Next i
    .ListIndex = -1
    End With
    CommandButton3.Visible = False
    CommandButton4.Visible = False
    Label27.Caption = "mode : création"
    End Sub

    Private Sub Frame4_Click()

    End Sub

    Private Sub Frame5_Click()

    End Sub

    Private Sub Label27_Click()

    End Sub

    Private Sub TextBox1_Change()

    End Sub

    Private Sub UserForm_Initialize()
    Label27.Caption = "mode : création"
    initialisecombo
    End Sub
    Public Sub initialisecombo()
    Dim i As Integer
    With ComboBox1
    .Clear
    .ColumnCount = 2
    .ColumnWidths = "50;0"
    End With
    With Sheets("feuil1")
    For i = 2 To .Range("a65536").End(xlUp).Row
    ComboBox1.AddItem
    ComboBox1.List(ComboBox1.ListCount - 1, 0) = .Cells(i, 1)
    ComboBox1.List(ComboBox1.ListCount - 1, 1) = i
    Next i
    End With
    End Sub

    Cordialement
    0
  2. teckmicro Messages postés 89 Date d'inscription   Statut Membre Dernière intervention  
     
    .
    0