I have a workbook that has a worksheet containing "Incidents" and "CLOSED" incidents. I need a macro that moves(cuts) all of the "CLOSED" incidents (rows) from the "Incidents" worksheet to the "Closed Incidents" worksheet. This will be updated monthly.
The code I have copies all of the information. I thought about filtering the column that contains the status however it did not work. Here is the code:
Sub MoveClosedIncidents()
Dim SourceRange As Range, DestRange As Range
Dim DestSheet As Worksheet, Lr As Long
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Const shtSource = "Incidents"
Const shtDest = "CLOSED Incidents"
Set SourceRange = Sheets("Incidents").Range("A2:P50000")
Set DestSheet = Sheets("CLOSED Incidents")
Lr = lastrow(DestSheet)
Set DestRange = DestSheet.Range("A" & Lr + 1)
Sheets("Incidents").Activate
DeleteBlankRows (this sub is for deleting any blank rows that might exist between rows)
SourceRange.Copy DestRange
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Column M contains the status which will be the filtered column. Any help/hints are appreciated.
The code I have copies all of the information. I thought about filtering the column that contains the status however it did not work. Here is the code:
Sub MoveClosedIncidents()
Dim SourceRange As Range, DestRange As Range
Dim DestSheet As Worksheet, Lr As Long
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Const shtSource = "Incidents"
Const shtDest = "CLOSED Incidents"
Set SourceRange = Sheets("Incidents").Range("A2:P50000")
Set DestSheet = Sheets("CLOSED Incidents")
Lr = lastrow(DestSheet)
Set DestRange = DestSheet.Range("A" & Lr + 1)
Sheets("Incidents").Activate
DeleteBlankRows (this sub is for deleting any blank rows that might exist between rows)
SourceRange.Copy DestRange
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Column M contains the status which will be the filtered column. Any help/hints are appreciated.