SamarthSalunkhe
Board Regular
- Joined
- Jun 14, 2021
- Messages
- 103
- Office Version
- 2016
- Platform
- Windows
Hi All,
I'm using the below user form to add data and to edit data. I have Encrypted Database Sheet to avoid unwanted modification in files and to add data and edit data purposes I have created a user form.
In addition in this form, I want one code to copy data which is selected for modification because I don't want to lose previous data from the record.
below is code I am using for edit click butten.
I'm using the below user form to add data and to edit data. I have Encrypted Database Sheet to avoid unwanted modification in files and to add data and edit data purposes I have created a user form.
In addition in this form, I want one code to copy data which is selected for modification because I don't want to lose previous data from the record.
below is code I am using for edit click butten.
VBA Code:
Private Sub cmdEdit_Click()
If Selected_List = 0 Then
MsgBox "No row is selected.", vbOKOnly + vbInformation, "Edit"
Exit Sub
End If
'Code to update the value to respective controls
Me.txtRowNumber.Value = Application.WorksheetFunction.Match(Me.lstDatabase.List(Me.lstDatabase.ListIndex, 0), _
ThisWorkbook.Sheets("Database").Range("A:A"), 0)
Me.txtRemark.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 1)
Me.txtTally.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 2)
Me.txtName.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 3)
Me.txtAccount.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 4)
Me.txtIFSC.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 5)
Me.txtBank.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 6)
MsgBox "Please make the required changes and click on 'Save' button to update.", vbOKOnly + vbInformation, "Edit"
End Sub