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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

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