Hello Infinity,
Error code 13 is a "Type mismatch" error. The code is trying to check if the Target value is equal to the value of cells A1 to A3. The Value property doesn't return an array of values. This is what causes the mismatch error. If you want to restrict the user selection to cells A1 to A3 then the code needs to be as follows...
Sub Worksheet_Change(ByVal Target As Range)
Dim iRow As Integer 'start row for sheet2
Dim iCol As Integer 'start col for sheet2
'only snap those changes occurred at A1 to A3 on the ActiveSheet, while others omitted
Application.EnableEvents = False
If Not Intersect(Target, Range("A1:A3")) Is Nothing Then
iCol = 1
iRow = Worksheets("sheet2").Cells(Rows.Count, iCol).End(xlUp).Row
If iRow > 1 Then iRow = iRow + 1
Worksheets("sheet2").Cells(iRow, iCol).Value = Target.Value
End If
Application.EnableEvents = True
End Sub
Sincerely,
Leith Ross
Bookmarks