Forum Discussion
imconfused
Apr 08, 2021Copper Contributor
Excel question - auto copy info onto a second sheet
I want to create a spreadsheet where information from some selected cells is duplicated on a second sheet simultaneously. Is there a way to do this? For example, I want to enter property addresses ...
Subodh_Tiwari_sktneer
Apr 08, 2021Silver Contributor
Assuming you have two sheets called Sheet1 and Sheet2 in the file and you want to duplicate what you input in column A on Sheet1 on to the Sheet2, then follow the steps given below...
- Right Click on Sheet1 Tab Name and choose View Code.
- Copy the code given below and paste into the opened Code Window.
- Save your workbook as Macro-Enabled Workbook and you are good to go.
To test the code, now enter some values in column A on Sheet1 and those values will be copied to the Sheet2 automatically.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim wsDest As Worksheet
Dim Cel As Range
Set wsDest = ThisWorkbook.Worksheets("Sheet2") 'The changes on Sheet1 will be copied to Sheet2, Change the name of the destination sheet if required
If Not Intersect(Target, Range("A:A")) Is Nothing Then
For Each Cel In Target
wsDest.Range(Cel.Address).Value = Cel.Value
Next Cel
End If
End Sub
- Subodh_Tiwari_sktneerApr 08, 2021Silver Contributor
And if you don't want a macro based solution, you may also place the following formula on Sheet2
On Sheet2
In A1
=IF(Sheet1!A1="","",Sheet1!A1)
and copy it down the rows.