Carl_London
New Member
- Joined
- Feb 28, 2023
- Messages
- 19
- Office Version
- 2016
- Platform
- Windows
I am new to excel and using macros so please be kind!
I wish to copy an entire row from one worksheet called "list" and copy that entire row to another worksheet called "logged". The copied row should go to the next available empty row in the "logged" worksheet and then clear the contents of that row from the original worksheet. I would like to be able to do the move by using a macro button.
Can anyone help please?
Thanks, Carl
This code works but not the way I want, in this version I have to enter an "l" in the coloumn A of the first worksheet, but I'd rather do it with one mouse click of a button:
Private Sub Worksheet_Change(ByVal Target As Range)
' Check to see only one cell updated If Target.CountLarge > 1 Then Exit Sub
' Check to see if entry is made in column B after row 5 and is set to "Yes" If Target.Column = 1 And Target.Row > 4 And Target.Value = "l" Then Application.EnableEvents = False ' Copy columns B to M to complete sheet in next available row Range(Cells(Target.Row, "B"), Cells(Target.Row, "N")).Copy Sheets("logged").Cells(Rows.Count, "B").End(xlUp).Offset(1, 0) ' Delete current row after copied Rows(Target.Row).ClearContents Application.EnableEvents = True
I wish to copy an entire row from one worksheet called "list" and copy that entire row to another worksheet called "logged". The copied row should go to the next available empty row in the "logged" worksheet and then clear the contents of that row from the original worksheet. I would like to be able to do the move by using a macro button.
Can anyone help please?
Thanks, Carl
This code works but not the way I want, in this version I have to enter an "l" in the coloumn A of the first worksheet, but I'd rather do it with one mouse click of a button:
Private Sub Worksheet_Change(ByVal Target As Range)
' Check to see only one cell updated If Target.CountLarge > 1 Then Exit Sub
' Check to see if entry is made in column B after row 5 and is set to "Yes" If Target.Column = 1 And Target.Row > 4 And Target.Value = "l" Then Application.EnableEvents = False ' Copy columns B to M to complete sheet in next available row Range(Cells(Target.Row, "B"), Cells(Target.Row, "N")).Copy Sheets("logged").Cells(Rows.Count, "B").End(xlUp).Offset(1, 0) ' Delete current row after copied Rows(Target.Row).ClearContents Application.EnableEvents = True