dcsimg
Results 1 to 7 of 7

Thread: VBA - Execution error

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2019
    Posts
    1

    VBA - Execution error

    Morning,

    Please help me to optimize my code VBA (Excel) see below.
    Actually i have an execution error1004 at line " MyDataRealise.Cells(rg.Row, "A").EntireRow.Delete"
    Code:
    Dim clebudget As String
    Dim rg, rgmois As Range
    Dim reponse As Integer
    Dim MyDataRealise As Object
    
    clebudget = ListBoxBudgetReel.Column(1, ListBoxBudgetReel.ListIndex) & "/" & ListBoxBudgetReel.Column(0, ListBoxBudgetReel.ListIndex) & "-" & ListBoxBudgetReel.Column(3, ListBoxBudgetReel.ListIndex)
    
    Set MyDataRealise = Sheets("Realise").Range("F1").CurrentRegion
    Set rg = MyDataRealise.Range("F1:F10000").Find(clebudget, MyDataRealise.Range("F1"), LookIn:=xlValues, LookAt:=xlWhole)
    
    If Not rg Is Nothing Then
       reponse = MsgBox("Voulez vous vraiment supprimer cet enregistrement ?", vbYesNo + vbQuestion, "Confirmation")
        If reponse = vbYes Then
            MyDataRealise.Cells(rg.Row, "A").EntireRow.Delete
            MsgBox "Enregistrement supprimé avec succès !", vbInformation, "Informations"
            ListBoxBudgetReel.RowSource = "Tabrealise"
        End If
    Else
        MsgBox "Impossible de supprimer l'enregistrement !", vbCritical, "Informations"
    
    End If
    Last edited by Shaggy Hiker; Apr 30th, 2019 at 03:58 PM. Reason: Added CODE tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width