Hi guys,
I hope everyone is doing well!
Just a quick question, I have a table on Sheet 1, with data that is populated using power query SQL source. My apologies if my question is a little confusing, I wasn't really too sure how to word it.
What I'm needing help with is somehow making it so that data in the table on sheet 1 is copied into a new sheet in a table, creating a historical database.
The table that updates, on sheet 1; Column C is peoples names which starts at C5 ends at C9 (list of names my grow in future), then the data that changes is each coloum from D to M for each person. I've attached a simple example of the table
I'm not really too sure how I might go about achieving this but I was playing around with some code I found but haven't really gotten anywhere.
I would greatly appreciate any advice or assistance.
Many thanks for any inputs!
Ps. sorry in advance for any delayed responses.
I hope everyone is doing well!
Just a quick question, I have a table on Sheet 1, with data that is populated using power query SQL source. My apologies if my question is a little confusing, I wasn't really too sure how to word it.
What I'm needing help with is somehow making it so that data in the table on sheet 1 is copied into a new sheet in a table, creating a historical database.
The table that updates, on sheet 1; Column C is peoples names which starts at C5 ends at C9 (list of names my grow in future), then the data that changes is each coloum from D to M for each person. I've attached a simple example of the table
I'm not really too sure how I might go about achieving this but I was playing around with some code I found but haven't really gotten anywhere.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim wsMain As Worksheet, wsHistory As Worksheet
Dim NextRow As Long
Set wsMain = Sheets("Sheet1")
Set wsHistory = Sheets("Sheet2")
If Target.Address = "$D$5" Then
NextRow = wsHistory.Cells(Rows.Count, 2).End(xlUp).Row + 1
' Copy values
wsHistory.Range("A" & NextRow).Value = wsMain.Range("C5").Value
wsHistory.Range("B" & NextRow).Value = wsMain.Range("D5").Value
wsHistory.Range("c" & NextRow).Value = wsMain.Range("E5").Value
wsHistory.Range("d" & NextRow).Value = wsMain.Range("F5").Value
wsHistory.Range("e" & NextRow).Value = wsMain.Range("G5").Value
wsHistory.Range("f" & NextRow).Value = wsMain.Range("H5").Value
wsHistory.Range("g" & NextRow).Value = wsMain.Range("I5").Value
wsHistory.Range("h" & NextRow).Value = wsMain.Range("J5").Value
wsHistory.Range("i" & NextRow).Value = wsMain.Range("K5").Value
wsHistory.Range("j" & NextRow).Value = wsMain.Range("L5").Value
wsHistory.Range("k" & NextRow).Value = wsMain.Range("M5").Value
End If
End Sub
I would greatly appreciate any advice or assistance.
Many thanks for any inputs!
Ps. sorry in advance for any delayed responses.