Comment Modifier ce Code pour Supprimer une Ligne dans la Feuille

MuscatMimi

XLDnaute Accro
Bonjour a tout le Forum


Dans le code ci-dessous, qui fonctionne bien pour Valider une liste de N° dans une Colonne

J'aimerais connaitre la proccédure a inclure (a la place du code en rouge) pour Supprimer
une ligne a chaque fois qu'un Item est sélectionné dans la ComboBox2 de mon Usf

Code:
Private Sub CommandButton2_Click() 'Ajoute liste de N° dans la base 
'Depuis Userform1
Dim ligne As Integer
Dim NDF As String
Dim XlApp As Object, XlDoc As Object
Dim Ouvert As Boolean

    Application.DisplayAlerts = False
    NDF = ActiveDocument.Path & FichierCentral
    On Error Resume Next
    
    Set XlApp = GetObject(, "Excel.Application")
    If Err.Number <> 0 Then
        Set XlApp = CreateObject("Excel.Application")
        NDF = XlApp.WorksheetFunction.Substitute(NDF, "\Doc\", "\")
        Set XlDoc = XlApp.Workbooks.Open(NDF, ReadOnly:=False)
        Ouvert = False
    Else
        NDF = XlApp.WorksheetFunction.Substitute(NDF, "\Doc\", "\")
        Set XlDoc = GetObject(NDF)
        If Not XlApp.Workbooks(NDF) Is Nothing Then Set XlDoc = XlApp.Workbooks.Open(NDF, ReadOnly:=False)
        Ouvert = True
    End If
    Err.Clear
    
    With XlApp
        .Visible = False
        '****
         [COLOR="Red"] 'Dim PremNumChq, NbChq, Cel, Indic As Integer
          ' PremNumChq = TextBox1
          'NbChq = TextBox2

        'With .ActiveWorkbook.Sheets("Clients")
        'Indic = Right(TextBox1, 3)
        ' For Cel = 1 To NbChq + 1
        '.Cells(Cel, 6) = Format(PremNumChq, "0000/000")
        ' Indic = Indic + 1
        'PremNumChq = Left(TextBox1, 5) & Indic
        'Next Cel
        End With[/COLOR]
            .Visible = Ouvert
        With .Application
            .DisplayAlerts = False
            .Save
            If Not Ouvert Then .Quit
            .DisplayAlerts = True
        End With
    End With
    Set XlDoc = Nothing
    Set XlApp = Nothing
    Application.DisplayAlerts = True
    'InsèreDonnées
    'Unload Me
End Sub

J'espére être assez explicite,sinon redemander infos supplémentaire

merci de votre aide
Cordialement
 

Discussions similaires

Réponses
1
Affichages
306
Compte Supprimé 979
C
Réponses
14
Affichages
668

Statistiques des forums

Discussions
312 315
Messages
2 087 168
Membres
103 489
dernier inscrit
CACCA