Hello, I have a very similar issue to another older thread that was posted here a couple years ago.
I was hoping to get some help coding a macro to move data from one sheet to another and delete from the original sheet. In my spreadsheet I have these columns:
A B C D E F G H I
GC Project Name Location Material Date Time Status Estimator Notes
What I was hoping to have happen is any rows in the Status column with "Submitted" in the cell to be moved to the other sheet and deleted from the first sheet. For example G3 and G7 have Submitted in their cells, and would therefor be moved to the second sheet, and deleted from the first sheet once the macro was run. My first sheet is called Commercial_Bid_Tracking and my second sheet is called Submitted_Jobs
Below is the code that Michael M had written in 2017 and seems very close to what I need, with a couple adjustments.
Sub MM1() 'no header row
Dim lr As Long
If Application.WorksheetFunction.CountIf(Range("D:D"), "Yes") = 0 Then Exit Sub
Application.DisplayAlerts = False
lr = Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row 'change sheet name to suit
With Sheets("Sheet1").UsedRange
.AutoFilter
.AutoFilter field:=4, Criteria1:="Yes"
.Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).Copy Sheets("Sheet2").Range("A" & lr + 1)
.Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).Delete
.AutoFilter
End With
Application.DisplayAlerts = True
End Sub
I tried running this code with what I thought needed to be adjusted and couldn't get it to work because I have very little knowledge in coding. Any assistance with this would be very much appreciated. Thanks in advance!
I was hoping to get some help coding a macro to move data from one sheet to another and delete from the original sheet. In my spreadsheet I have these columns:
A B C D E F G H I
GC Project Name Location Material Date Time Status Estimator Notes
What I was hoping to have happen is any rows in the Status column with "Submitted" in the cell to be moved to the other sheet and deleted from the first sheet. For example G3 and G7 have Submitted in their cells, and would therefor be moved to the second sheet, and deleted from the first sheet once the macro was run. My first sheet is called Commercial_Bid_Tracking and my second sheet is called Submitted_Jobs
Below is the code that Michael M had written in 2017 and seems very close to what I need, with a couple adjustments.
Sub MM1() 'no header row
Dim lr As Long
If Application.WorksheetFunction.CountIf(Range("D:D"), "Yes") = 0 Then Exit Sub
Application.DisplayAlerts = False
lr = Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row 'change sheet name to suit
With Sheets("Sheet1").UsedRange
.AutoFilter
.AutoFilter field:=4, Criteria1:="Yes"
.Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).Copy Sheets("Sheet2").Range("A" & lr + 1)
.Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).Delete
.AutoFilter
End With
Application.DisplayAlerts = True
End Sub
I tried running this code with what I thought needed to be adjusted and couldn't get it to work because I have very little knowledge in coding. Any assistance with this would be very much appreciated. Thanks in advance!