Moving Row from Active Workbook to Complete Workbook

SheboyganFalls9

New Member
Joined
Feb 16, 2024
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I am building a workbook that when a cell is filled it will move that row from the active workbook to the complete workbook. The rows will be random about which one is moving at a time so I would like the Complete moving to be the next available row. How would I accomplish this?

1708102544423.png
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
What is the trigger to determine if a row is complete? And do you want to move the data from one sheet to another and remove the data from the original sheet, or just copy to new sheet?
 
Upvote 0
What is the trigger to determine if a row is complete? And do you want to move the data from one sheet to another and remove the data from the original sheet, or just copy to new sheet?
The trigger would be the complete column cell. I would like the removed completely from the active tab and moved to the complete tav
 
Upvote 0
What value would be entered into the Complete column cell?
 
Upvote 0
Which column will always have data in it when new entries are created?
 
Upvote 0
Which column will always have data in it when new entries are created?
All of the columns will be filled out from A to P. I added the Q column so I could make that the trigger spot for when the row should be moved from active to completed.
 
Upvote 0
Okay, I believe the following code will do what you're after, but I had to stop testing it as my Excel started behaving erratically while using it. So... test it on a copy of your book, and I hope it's just my Excel being stupid.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo SetMeFree
Dim ws As Worksheet
Dim lRowA As Long, lRowC As Long

Application.EnableEvents = False
Application.ScreenUpdating = False

Set ws = Worksheets("Complete")
lRowA = Range("A" & Rows.Count).End(xlUp).Row
lRowC = ws.Range("A" & Rows.Count).End(xlUp).Row + 1

If Not Intersect(Target, Range("Q2:Q" & lRowA)) Is Nothing And Target.Count = 1 Then
    If Range("Q" & Target.Row).Value = "Yes" Then
        Range("A" & Target.Row & ":Q" & Target.Row).Copy
        ws.Range("A" & lRowC).PasteSpecial xlPasteValues
        Rows(Target.Row & ":" & Target.Row).Delete Shift:=xlUp
        Application.CutCopyMode = False
    End If
Else
   GoTo SetMeFree
End If

SetMeFree:
Application.ScreenUpdating = True
Application.EnableEvents = True

End Sub
 
Upvote 1
Solution
Okay, I believe the following code will do what you're after, but I had to stop testing it as my Excel started behaving erratically while using it. So... test it on a copy of your book, and I hope it's just my Excel being stupid.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo SetMeFree
Dim ws As Worksheet
Dim lRowA As Long, lRowC As Long

Application.EnableEvents = False
Application.ScreenUpdating = False

Set ws = Worksheets("Complete")
lRowA = Range("A" & Rows.Count).End(xlUp).Row
lRowC = ws.Range("A" & Rows.Count).End(xlUp).Row + 1

If Not Intersect(Target, Range("Q2:Q" & lRowA)) Is Nothing And Target.Count = 1 Then
    If Range("Q" & Target.Row).Value = "Yes" Then
        Range("A" & Target.Row & ":Q" & Target.Row).Copy
        ws.Range("A" & lRowC).PasteSpecial xlPasteValues
        Rows(Target.Row & ":" & Target.Row).Delete Shift:=xlUp
        Application.CutCopyMode = False
    End If
Else
   GoTo SetMeFree
End If

SetMeFree:
Application.ScreenUpdating = True
Application.EnableEvents = True

End Sub
It works perfectly. Thank you so much for your help
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,992
Members
449,094
Latest member
masterms

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top