+ Reply to Thread
Results 1 to 3 of 3

How do I update the selected row in the listbox?

Hybrid View

ambroisa How do I update the selected... 01-15-2019, 12:39 AM
Sintek Re: How do I update the... 01-15-2019, 04:31 AM
dotchiejack Re: How do I update the... 01-15-2019, 05:05 AM
  1. #1
    Registered User
    Join Date
    01-09-2019
    Location
    Philippines
    MS-Off Ver
    MS-Office 2016
    Posts
    1

    How do I update the selected row in the listbox?

    Hello so I have a Userform that has a listbox. When a user clicked a value from the listbox, it will be displayed on the corresponding comboboxes below, thus allowing the user to edit the value and update the row by selecting the Update Button.

    mew.PNG

    Sadly, I couldn't make that work and i'm going nuts. It's my first time to create a userform.

    Here's my pathetic code and yes I don't have a code for Update button

    
    
         Private Sub btnDelete_Click()
        
            Dim a As Integer
                
                If MsgBox("Are you sure you want to delete this row?", vbYesNo + vbQuestion, "Yes") = vbYes Then
                
                    For a = 1 To Range("A100000").End(xlUp).Row
                        If Cells(a, 1) = listHeader.List(listHeader.ListIndex) Then
                        Rows(a).Select
                        Selection.Delete
                    End If
                Next a
            End If
        
        End Sub
        
        Private Sub btnView_Click()
        
            listHeader.RowSource = "A4:H1000"
        
        End Sub
        
    Private Sub cmbAdd_Click()
        Dim sheet As Worksheet
        Set sheet = ThisWorkbook.Sheets("PRESTAGE DB")
        
        nextrow = sheet.Cells(Rows.Count, 1).End(xlUp).Row + 1
        
        sheet.Cells(nextrow, 1) = Me.cmbSchema
        sheet.Cells(nextrow, 2) = Me.cmbEnvironment
        sheet.Cells(nextrow, 3) = Me.cmbHost
        sheet.Cells(nextrow, 4) = Me.cmbIP
        sheet.Cells(nextrow, 5) = Me.cmbAccessible
        sheet.Cells(nextrow, 6) = Me.cmbLast
        sheet.Cells(nextrow, 7) = Me.cmbConfirmation
        sheet.Cells(nextrow, 8) = Me.cmbProjects
           
    End Sub
    
        Private Sub cmbUpdate_Click()
        
        
        End Sub
        
        Private Sub CommandButton5_Click()
            listHeader.RowSource = ""
        
        End Sub
        
        Private Sub listHeader_Click()
        
        Dim rngMyData As Range
        
            cmbSchema.Value = UserForm1.listHeader.Column(0)
            cmbEnvironment.Value = UserForm1.listHeader.Column(1)
            cmbHost.Value = UserForm1.listHeader.Column(2)
            cmbIP.Value = UserForm1.listHeader.Column(3)
            cmbAccessible.Value = UserForm1.listHeader.Column(4)
            cmbLast.Value = UserForm1.listHeader.Column(5)
            cmbConfirmation.Value = UserForm1.listHeader.Column(6)
            cmbProjects.Value = UserForm1.listHeader.Column(7)
            
        
        End Sub

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: How do I update the selected row in the listbox?

    I would suggest not updating the listbox...Update the sheet which in turn updates the listbox...
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: How do I update the selected row in the listbox?

    You should post an example of your workbook instead of a picture.
    Click the * Add Reputation below to say thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Moving all columns from listbox 1 to listbox 2 and see all details of an selected item
    By alexgoaga in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2018, 07:09 PM
  2. [SOLVED] How to update selected item in a listbox using a combo box?
    By reddwarf in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2017, 03:40 PM
  3. Live update of .ListBox.Selected
    By radddogg in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-16-2017, 04:17 AM
  4. Show dynamic values at listbox depending value selected another listbox
    By Judith_Chao in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2017, 08:30 AM
  5. [SOLVED] Update (strikethrough) Listbox item selected within sheet
    By ShaunRoos in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2014, 02:45 PM
  6. Copy Selected items from multicolumn, multiselect listbox to another listbox
    By Willigb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2013, 11:27 AM
  7. Populate userform listbox based on value selected in another listbox
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-07-2012, 05:16 PM

Tags for this Thread

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