Results 1 to 5 of 5

Userform Run-time error 1004

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-21-2015
    Location
    nederland
    MS-Off Ver
    2021
    Posts
    206

    Userform Run-time error 1004

    Dear mr / mrs,

    I get run-time error 1004 when I try to delete data with cmdDelete see below the VBA

    Rowsource listbox1 = information

    please help me to resolve this issue
    thank you in advance for your support

    Kirana

    Private Sub ListBox1_Click()
    Dim say As Long, A As Byte, r As Long
    Dinfo1 = ListBox1.List(ListBox1.ListIndex, 0)
    
    For A = 1 To 6
    Controls("Info" & A) = ListBox1.List(ListBox1.ListIndex, A - 1)
    Next
    
    Sheets("Data").Range("A:A").Find(ListBox1.Text).Activate
    say = ActiveCell.Row
    Sheets("Data").Range("A" & say & ":I" & say).Select
    TextBox1 = ListBox1.ListIndex + 1
    End Sub
    
    
    Private Sub cmdDelete_Click()
    Dim findvalue As Range
        Dim cDelete As VbMsgBoxResult
        Dim cNum As Integer
        'check for values
        If Info1.Value = "" Or Info2.Value = "" Then
            MsgBox "There is not data to delete"
            Exit Sub
        End If
        'give the user a chance to change their mind
        cDelete = MsgBox("Are you sure that you want to delete Select Data", vbYesNo + vbDefaultButton2, "Are you sure????")
        If cDelete = vbYes Then
            'delete the row
            Set findvalue = Sheet1.Range("B:B").Find(What:=Info2, LookIn:=xlValues)
            findvalue.EntireRow.Delete
        End If
        'clear the controls
        cNum = 6
        For X = 1 To cNum
            Me.Controls("Info" & X).Value = ""
        Next
        'refresh the listbox
        Unload Me
        frmaddress.Show
    End Sub
    Attached Files Attached Files
    Last edited by kirana2014; 11-28-2017 at 01:44 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] I am getting error as "Run Time error '1004' Microsoft excel cannot paste the data
    By Amittapre in forum Excel Programming / VBA / Macros
    Replies: 43
    Last Post: 03-24-2017, 04:40 PM
  2. [SOLVED] Sort Macro Run-time error '1004': Application/Object-defined error.
    By sam1212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2014, 10:05 AM
  3. Run time error 1004 on userform initialize
    By Nitefox in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-09-2014, 12:44 PM
  4. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  5. Fix Userform IF Statement - Run Time Error "1004"
    By sawan202 in forum Excel General
    Replies: 2
    Last Post: 03-07-2012, 06:32 AM
  6. Run time error 1004-created a userform
    By scrupo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-23-2010, 04:11 AM
  7. Run-time error 1004 when trying to load UserForm
    By jasoncw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-22-2008, 04:28 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1