Developer technologies | Visual Basic for Applications
An implementation of Visual Basic that is built into Microsoft products.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello I spent more time on the macro to update the list box. It does make changes to the one I selected; however it just adds a new line with the changes leaving the original untouched. The words in bold are two lines I added. Many thanks to those who have helped me thus far.
Thank you,
Private Sub cmdEdit2_Click()
If Selected_list2 = 0 Then
Dim tbl As ListObject
Set tbl = Worksheets("Pallets").ListObjects("Table1")
MsgBox "No row is selected.", vbOKOnly + vbInformation, "Edit"
Exit Sub
End If
'code to update the value of respective controls
Me.txtRowNumber2.Value = Selected_list2 + 1
Me.txtDate.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 0)
Me.txtDestination.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 1)
Me.txtPalletID.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 2)
Me.txtTcns.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 3)
Me.txtPieces.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 4)
Me.txtWeight.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 5)
Me.cmbShipment.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 6)
Me.cmbSupport.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 8)
Me.txtRemarks.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 9)
MsgBox "Please make the required changes and click on 'Save' button to update,", vbOKOnly + vbInformation, "Edit"
End Sub
An implementation of Visual Basic that is built into Microsoft products.