Macro to copy specific data [Closed]

Report
Posts
12
Registration date
Friday May 15, 2015
Status
Member
Last seen
June 5, 2015
-
Hi,

I have the following script which copies data in cell A in the row where "Y" is clicked in column 26 from worksheet One to cell A in the next blank row in worksheet Two. Can you please edit the script to also copy data in cells B,E,G of that row in worksheet One to worksheet Two:

Private Sub Worksheet_Change(ByVal Target As Range)
If ActiveCell.Row > 1 Then
If Target.Column = 26 And UCase(Cells(ActiveCell.Row, 26)) = "Y" Then

kk = 0
On Error Resume Next
kk = Application.WorksheetFunction.VLookup(Cells(ActiveCell.Row, 1), Sheets("Two").Range("A:A"), 1, False)

If kk = 0 Then
        Dim lastRow As Long
        With Sheets("2")
            lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
            .Cells(lastRow + 1, 1) = Cells(ActiveCell.Row, 1)
        End With
        
        MsgBox "App ID " & Cells(ActiveCell.Row, 1) & " copied to 'Two' worksheet", vbInformation, "Done!"

    End If
End If
End If
End Sub

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!