I have a workbook with 2 sheets HistoryD and HistoryDD ....I have the following code to copy Column A-G from HistoryD to HistoryDD if any value is changed on B2-G2 -but when I change a value the macro thats been called have a n error about the range "Select error of range failed"...it complains about this line Range("A1").Select . Rep given for solution as its done with the macro recorder but its not running through ....What must be changed in the code ?? Thank you
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Value = vbNullString Then Exit Sub
If Not Intersect(Range("B2:G2"), Target) Is Nothing Then
CopyHis
End If
End Sub
Sub CopyHis()
'
' CopyHis Macro
'
'
Columns("A:G").Select
Selection.Copy
Sheets("HistoryDD").Select
Range("A1").Select
ActiveSheet.Paste
Rows("2:2").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
End Sub
Bookmarks