I have been trying to modify attached program so that when the value of cell "B12", "B13" changes, the program will then take the newly entered the value of "B12" and "B13" and paste it to cells located at the button of the sheet ("I22:J24").
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = "$N$3" Then
V = Application.Match(Target.Value, Range("A21", [A21].End(xlDown)), 0)
If IsNumeric(V) Then
V = 20 + V
[B3].Value = Target.Value
[D3].Value = Cells(V, 2).Value
[F3].Value = Cells(V, 3).Value
[H3].Value = Cells(V, 4).Value
[B5].Value = Cells(V, 5).Value
[B7].Value = Cells(V, 6).Value
[B9].Value = Cells(V, 7).Value
[B11].Value = Cells(V, 8).Value
[B12].Value = Cells(V, 9).Value
[B13].Value = Cells(V, 10).Value
[B14].Value = Cells(V, 11).Value
Else
If Target.Value > "" Then Beep
[B3,D3,F3,H3,B5,B7,B9,B11,B12.B13.B14].Value = ""
End If
ElseIf Target.Address = "$B$13" Then
Dim lr As Integer
lr = Range("A" & Rows.Count).End(xlUp).Row + 1
Range("A" & lr).Value = Range("B3").Value
Range("B" & lr).Value = Range("D3").Value
Range("C" & lr).Value = Range("F3").Value
Range("D" & lr).Value = Range("H3").Value
Range("E" & lr).Value = Range("B5").Value
Range("F" & lr).Value = Range("B7").Value
Range("G" & lr).Value = Range("B9").Value
Range("H" & lr).Value = Range("B11").Value
Range("I" & lr).Value = Range("B12").Value
Range("J" & lr).Value = Range("B13").Value
Range("K" & lr).Value = Range("B14").Value
[B3,D3,F3,H3,B5,B7,B9,B11,B12,B13,B14].Value = ""
End If
Application.EnableEvents = True
End Sub
Try this modification to your code
Code:Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False If Target.Address = "$N$3" Then V = Application.Match(Target.Value, Range("A21", [A21].End(xlDown)), 0) If IsNumeric(V) Then V = 20 + V [B3].Value = Target.Value [D3].Value = Cells(V, 2).Value [F3].Value = Cells(V, 3).Value [H3].Value = Cells(V, 4).Value [B5].Value = Cells(V, 5).Value [B7].Value = Cells(V, 6).Value [B9].Value = Cells(V, 7).Value [B11].Value = Cells(V, 8).Value [B12].Value = Cells(V, 9).Value [B13].Value = Cells(V, 10).Value [B14].Value = Cells(V, 11).Value Else If Target.Value > "" Then Beep [B3,D3,F3,H3,B5,B7,B9,B11,B12.B13.B14].Value = "" End If ElseIf Target.Address = "$B$13" Then Dim lr As Integer lr = Range("A" & Rows.Count).End(xlUp).Row + 1 Range("A" & lr).Value = Range("B3").Value Range("B" & lr).Value = Range("D3").Value Range("C" & lr).Value = Range("F3").Value Range("D" & lr).Value = Range("H3").Value Range("E" & lr).Value = Range("B5").Value Range("F" & lr).Value = Range("B7").Value Range("G" & lr).Value = Range("B9").Value Range("H" & lr).Value = Range("B11").Value Range("I" & lr).Value = Range("B12").Value Range("J" & lr).Value = Range("B13").Value Range("K" & lr).Value = Range("B14").Value [B3,D3,F3,H3,B5,B7,B9,B11,B12,B13,B14].Value = "" End If Application.EnableEvents = True End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = "$N$3" Then
V = Application.Match(Target.Value, Range("A21", [A21].End(xlDown)), 0)
If IsNumeric(V) Then
V = 20 + V
[B3].Value = Target.Value
[D3].Value = Cells(V, 2).Value
[F3].Value = Cells(V, 3).Value
[H3].Value = Cells(V, 4).Value
[B5].Value = Cells(V, 5).Value
[B7].Value = Cells(V, 6).Value
[B9].Value = Cells(V, 7).Value
[B11].Value = Cells(V, 8).Value
[B12].Value = Cells(V, 9).Value
[B13].Value = Cells(V, 10).Value
[B14].Value = Cells(V, 11).Value
Else
If Target.Value > "" Then Beep
[B3,D3,F3,H3,B5,B7,B9,B11,B12.B13.B14].Value = ""
End If
ElseIf Target.Address = "$B$13" Then
Dim lr As Integer
lr = Application.Match([B3].Value, Range("A21", [A21].End(xlDown)), 0) + 20
Range("A" & lr).Value = Range("B3").Value
Range("B" & lr).Value = Range("D3").Value
Range("C" & lr).Value = Range("F3").Value
Range("D" & lr).Value = Range("H3").Value
Range("E" & lr).Value = Range("B5").Value
Range("F" & lr).Value = Range("B7").Value
Range("G" & lr).Value = Range("B9").Value
Range("H" & lr).Value = Range("B11").Value
Range("I" & lr).Value = Range("B12").Value
Range("J" & lr).Value = Range("B13").Value
Range("K" & lr).Value = Range("B14").Value
[B3,D3,F3,H3,B5,B7,B9,B11,B12,B13,B14].Value = ""
End If
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = "$N$3" Then
V = Application.Match(Target.Value, Range("A21", [A21].End(xlDown)), 0)
If IsNumeric(V) Then
V = 20 + V
[B3].Value = Target.Value
[D3].Value = Cells(V, 2).Value
[F3].Value = Cells(V, 3).Value
[H3].Value = Cells(V, 4).Value
[B5].Value = Cells(V, 5).Value
[B7].Value = Cells(V, 6).Value
[B9].Value = Cells(V, 7).Value
[B11].Value = Cells(V, 8).Value
[B12].Value = Cells(V, 9).Value
[B13].Value = Cells(V, 10).Value
[B14].Value = Cells(V, 11).Value
Else
If Target.Value > "" Then Beep
[B3,D3,F3,H3,B5,B7,B9,B11,B12.B13.B14].Value = ""
End If
ElseIf Target.Address = "$B$13" Then
Dim lr As Integer
lr = Application.Match([B3].Value, Range("A21", [A21].End(xlDown)), 0) + 20
'Range("A" & lr).Value = Range("B3").Value
'Range("B" & lr).Value = Range("D3").Value
'Range("C" & lr).Value = Range("F3").Value
'Range("D" & lr).Value = Range("H3").Value
'Range("E" & lr).Value = Range("B5").Value
'Range("F" & lr).Value = Range("B7").Value
'Range("G" & lr).Value = Range("B9").Value
'Range("H" & lr).Value = Range("B11").Value
'Range("I" & lr).Value = Range("B12").Value
Range("J" & lr).Value = Range("B13").Value
[B14].Value = Range("K" & lr).Value
'Range("K" & lr).Value = Range("B14").Value
'[B3,D3,F3,H3,B5,B7,B9,B11,B12,B13,B14].Value = ""
End If
Application.EnableEvents = True
End Sub