August 10, 2018

Microsoft Excel Copy row values to another sheet next available row when the value changes

Hi friends,

My friend had given me a problem in excel of copy row whenever the values changed to another sheet next available row.

I have come-up with this following code

Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Application.Intersect(Target, Target.ActiveSheet.Range("A1:D1")) Is Nothing Then
        Application.EnableEvents = False
        Application.ScreenUpdating = False
        MsgBox ("Hi")
        Call ValueChange
        Application.EnableEvents = True
    End If
End Sub
Sub ValueChange()
        Dim lastrow As Long
        
        lastrow = Sheets("Sheet2").Range("A65536").End(xlUp).Row + 1
        Sheets("Sheet2").Range("A" & lastrow & ": D" & lastrow).Value = Sheets("Sheet1").Range("A1:D1").Value

End Sub

Hope it will help you.

Note:
Please share your valuable comments and feedback to psrdotcom@gmail.com

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com