Auto copy data to another sheet after modification

SamarthSalunkhe

Board Regular
Joined
Jun 14, 2021
Messages
60
Office Version
  1. 2016
Platform
  1. 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.

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

1640148420184.png
 

Attachments

  • 1640147895747.png
    1640147895747.png
    19.2 KB · Views: 4

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,562
Messages
5,838,122
Members
430,529
Latest member
PaperBoi5870

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top