Auto copy data to another sheet after modification

SamarthSalunkhe

Board Regular
Joined
Jun 14, 2021
Messages
103
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: 13

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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
Back
Top