Advice on macro that moves rows across sheets
Hi all, recently I've been working on a new project that uses a macro to move rows of information across sheets, from sheets we call Triage to Open Tasks to Closed Tasks.
We do this to stimulate a work flow and actively management what tasks are being done etc.
I've ran into a bit of a problem,
Triage is a table, Open Tasks is a table and Closed tasks is range.
The issue is inbetween Triage and Open tasks, when I use the macro to move a row of information from triage to Open, it adds to the worksheet as part of a range and doesn't go into the table that I have in the Open tasks - this is a problem because when we go to Open tasks and start filtering information, it only filters the table stuff and not the range stuff, we really need the information to move into the table so it is considered in the filtering, we considered converting the table to a range, however, that defeats our automatic formulas that we get with having the information in a table.
Is there a way to assign the macro to move information into a table as opposed to the worksheet?
Any help is appreciated, thanks in advance.
The macro I use to move information is this:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nxtRow As Long
' Limit to a single cell change in columns 21
If Target.Count > 1 Then Exit Sub
If Target.Column < 21 Or Target.Column > 22 Then Exit Sub
' If column 21
If Target.Column = 21 And UCase(Target.Value) = "YES" Then
nxtRow = Sheets("Open tasks").Range("U" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy _
Destination:=Sheets("Open tasks").Range("A" & nxtRow)
Application.EnableEvents = False
Target.EntireRow.Delete
Application.EnableEvents = True
Exit Sub
End If
End Sub
|