Share via

Edit table through User Form update.

Anonymous
2022-09-27T00:52:18+00:00

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

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2022-09-27T05:36:43+00:00

    Hello embry,

    Thank you for using our Microsoft community.

    I hate to deliver you bad news, but this question is beyond the scope of Answers Support Community. The best place to get help with the macro in Excel is Microsoft Docs, which aims to support more advanced users like you.

    Here is a link to the forum where you can raise specific scenarios and share your idea to help solve the problem.

    I won't be able to help you, but I'll leave that question open in case one of our amazing volunteers has ideas for you.

    Thank you for your understanding and support.

    Sincerely

    Olivia - MSFT | Microsoft Community Support Specialist

    Was this answer helpful?

    0 comments No comments