Macros to transfer specific data from one sheet to another when a condition is met

IsaDiaz

New Member
Joined
Oct 13, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Hi everyone!
I hope you're all doing great
smile.gif


Could you please help me with this?

I need a macros that helps me move from tab 1 (OPEN REQUESTS) to tab 2 (COMPLETED REQUESTS) the records that have a date under the Completed Date column, but I need these records to be automatically removed from the first tab once the date is placed, and moved into the "COMPLETED" tab. Is this possible?

Is it necessary/Should I add a column where it's marked as "Completed" or something?

Thanks a lot for the help!
 

Attachments

  • Example to post - Excel 2021-10-25 17.55.07.png
    Example to post - Excel 2021-10-25 17.55.07.png
    34.7 KB · Views: 25

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Maybe this
VBA Code:
Sub MM1()
Dim lr As Long, r As Long
Application.screenudating = False
lr = Sheets("COMPLETED REQUESTS").Cells(Rows.Count, "A").End(xlUp).Row + 1
For r = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
    If Cells(r, "F") <> "" Then
        With Rows(r)
            .Copy Sheets("COMPLETED REQUESTS").Cells(lr, "A")
            .Delete
        End With
    lr = lr + 1
    End If
Next r
Application.screenudating = True
End Sub
 
Upvote 0
More efficient
VBA Code:
Sub MM3()
 Dim lr As Long
 lr = Sheets("COMPLETED REQUESTS").Cells(Rows.Count, "A").End(xlUp).Row + 1
With Sheets("OPEN REQUESTS").UsedRange
            .AutoFilter
            .AutoFilter field:=6, Criteria1:="<>"
            .Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).Copy Sheets("COMPLETED REQUESTS").Cells(lr, "A")
            .Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
            .AutoFilter
    End With
End Sub
 
Upvote 0
Solution
More efficient
VBA Code:
Sub MM3()
 Dim lr As Long
 lr = Sheets("COMPLETED REQUESTS").Cells(Rows.Count, "A").End(xlUp).Row + 1
With Sheets("OPEN REQUESTS").UsedRange
            .AutoFilter
            .AutoFilter field:=6, Criteria1:="<>"
            .Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).Copy Sheets("COMPLETED REQUESTS").Cells(lr, "A")
            .Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
            .AutoFilter
    End With
End Sub
Thank you! This worked perfectly, thanks a lot!
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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