Copy specific cells to new worksheet

hopr37

Board Regular
Joined
Apr 16, 2018
Messages
76
Trying to copy a specific cell(s) from sheet 1 to sheet 2 when a value in said cell changes.
example:
part 1.
sheet1 cell B2
value=1
sheet1 cell E2
Value is 10

Copies value from sheet1 cell B2 and sheet1 cell E2 to worksheet2 cell B2 and E2
part 2.
Sheet1 cell B2
Value changes to 2
sheet1 cell E2
Value is 20
copies new value from sheet1 cell B2 and E2 to sheet2 but moves new value down 1 cell to B3 and E3 but also leaving sheet2 cell B2 and cell E2 as is.
So everytime the value of sheet1 B2 and E2 changes, it copies that new changes to sheet2 but moves the new values down one row.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
How do the value of said cells change? Formula, manually, macro ?
 
Upvote 0
Use the Worksheet_Change event of sheet1
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'limit to single cell at a time
If Target.Count > 1 Then Exit Sub
'limit to B2, E2 only
If Target.Address <> "$B$2" And Target.Address <> "$E$2" Then Exit Sub

Dim wr As Long      'write row

With Sheets("Sheet2")
    wr = .Cells(Rows.Count, "B").End(xlUp).Row + 1
    .Cells(wr, "B") = Sheets("Sheet1").Cells(2, "B")
    .Cells(wr, "E") = Sheets("Sheet1").Cells(2, "E")
End With

End Sub
 
Upvote 0
.... uses wrong row if B2 happens to be blank, maybe get wr this way
Code:
    wr = .Cells.Columns("B:E").Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row + 1
 
Upvote 0

Forum statistics

Threads
1,214,431
Messages
6,119,458
Members
448,899
Latest member
maplemeadows

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