I am new to VBA code. I wrote a worksheet change event that copies rows from one tab to another based on whether there is a Y is a certain column. It works great, but it is slow. I would like to modify the code so the rows are copied over upon click of a button instead of each change... but I don't know where to begin or how to assign a button to this?
This is my worksheet:
This is my code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Column <> 6 Then Exit Sub
If Target = "Y" Then
Range("A" & Target.Row).Resize(, 5).Copy Sheets("GP Import").Cells(Sheets("GP Import").Rows.Count, "A").End(xlUp).Offset(1)
End If
Application.ScreenUpdating = False
End Sub
(Note that the button Generate Accounts is not actually doing anything at this point)
This is my worksheet:
This is my code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Column <> 6 Then Exit Sub
If Target = "Y" Then
Range("A" & Target.Row).Resize(, 5).Copy Sheets("GP Import").Cells(Sheets("GP Import").Rows.Count, "A").End(xlUp).Offset(1)
End If
Application.ScreenUpdating = False
End Sub
(Note that the button Generate Accounts is not actually doing anything at this point)