Right click on the EA - Coding Form tab, choose view code and paste the code into that window.
The code will run whenever you change the selection in the box. Check for accuracy because I just took the cells in your code where you pasted data into the data table and used them to put the data back. Then I restored your formulas with the total labels above them.
Good Luck!!!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$B$2" Then Exit Sub
Dim wsDataTable As Worksheet
Dim lr As Long, c As Long
Dim rng As Range, rngFound As Range, r As Range, rngReturnTo As Range
Application.ScreenUpdating = False
Sheet1.Unprotect
Set wsDataTable = Sheet2
lr = wsDataTable.Cells(Rows.Count, "A").End(xlUp).Row
If lr = 1 Then Exit Sub
Set rng = wsDataTable.Range("C2:C" & lr)
Set rngFound = rng.Find(Sheet1.Range("B2").Value)
If rngFound Is Nothing Then
MsgBox "No record found."
Exit Sub
End If
Set rngReturnTo = Sheet1.Range("B3:B7,C12,C15,F11:F17,C22,C25,F21:F27,C32,C35," _
& "F31:F37,I12,I15,L11:L17,I22,I25,L21:L27,I32,I35,L31:L37,C54,C57,B40")
c = 1
For Each r In rngReturnTo.Cells
r.Value = rngFound.Offset(, c - 1).Value
c = c + 1
Next r
Sheet1.Range("C15").Formula = "=SUM(F11:F17)"
Sheet1.Range("I15").Formula = "=SUM(L11:L17)"
Sheet1.Range("C25").Formula = "=SUM(F21:F27)"
Sheet1.Range("I25").Formula = "=SUM(L21:L27)"
Sheet1.Range("C35").Formula = "=SUM(F31:F37)"
Sheet1.Range("I35").Formula = "=SUM(L31:L37)"
Application.ScreenUpdating = True
End Sub
Bookmarks