I am struggling, wondering if there is any simple way to reference a cell from the current/active row.
i.e. – I have 2 sheets, one with lots of info on and the second I want to display info from the current/active row on Sheet 1.
So say row 5 was selected in Sheet 1. Then if you went to Sheet 2, all the info from row 5 would show on Sheet 2. Then if you selected row 8 on Sheet 1, the info on Sheet 2 would be updated to show only the info from row 8 on Sheet 1.
Any changes that you made on Sheet 2 would be reflected when you went back to Sheet 1.
Is there maybe a simple formula I could add to the cells on Sheet 2? Maybe something along the lines of:
cell A1 on sheet 2 have =sheet1(active_row.colum1)
and then cell A2 on sheet 2 have =sheet1(active_row.colum2)
etc, etc
I’ve managed to get it kind of working using a macro, but the only trouble is that when I alter the info on Sheet 2, it doesn’t update the info on Sheet 1. If there was a way to add this functionality to my code, that would be great.
This is the code I have so far:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myList
If Target.Address <> Target.EntireRow.Address Then Exit Sub
If Target.Rows.Count > 1 Then Exit Sub
myList = [{"B1","B2","B3","B4","B5","B6","B7","B8","B9","B10","B11","B12","B13","B14","B15"}] '<- adjust to your need
With Target.EntireRow
For i = 1 To UBound(myList)
Sheets("sheet2").Range(myList(i)).Value = .Cells(i).Value
Next
End With
End Sub
Any suggestions? 🙂
Yes, you can do this, but it’s a little bit complicated.
You want the row selected on Sheet 1 to display on Sheet 2, and then have be able to edit Sheet 2 to automatically update Sheet 1.
What you have to do is use the Selection event as you are, and copy the row to Sheet 2. Then you have to use the Activate event on Sheet 1 to copy the row back to Sheet 1. Please note that the following code assumes that Sheet 1 has no worksheet functions (formulas) in the cells, you could still do it, but you’d have to preserve the formulas and replace them.
Sheet 1 Code:
Sheet 2 Code: