If you put this in the code module for the sheet in question, it should do what you want. Changing a cell in either column B or C will cause the value in B to be put in the column that matches the column C entry. It does nothing if the entry in C has no match in D4:U4.
If you want to auto-adjust when the headers (D4:U4) are changed, remove the marked Exit Sub line midway through the code.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim cIndex As Variant, rindex As Long
If Target.Cells.Count = 1 Then
If Not (Application.Intersect(Target, Range("b2:c22")) Is Nothing) Then
With Target.EntireRow
cIndex = Application.Match(.Range("c1").Value, .Parent.Rows(4), 0)
If IsNumeric(cIndex) Then
.Range("D1:U1").ClearContents
.Parent.Cells(.Row, cIndex).Value = .Range("b1").Value
End If
End With
End If
Exit Sub: Rem remove for header trigger
If Not (Application.Intersect(Target, Range("D4:U4")) Is Nothing) Then
With Target.Parent.Range("c1:c22")
cIndex = Application.Transpose(.Value)
.ClearContents
For rindex = 1 To 22
.Cells(rindex, 1).Value = cIndex(rindex)
Next rindex
End With
End If
End If
End Sub
Bookmarks