I've been wracking my brain trying to solve this issue, and I bet it's super simple, but the answer is eluding me!
I'm trying to add a new row to a filtered table in Excel via a macro button. The macro works when the table is unfiltered but, due to client requirements, they want to add rows regardless of how filtered the table is. The user uses the column header dropdowns to filter the table - sometimes three or filters applied at a time.
Here is the current VBA code I'm using;
Public Sub Add_new_row_2()
Dim tbl As ListObject
Dim rw As Range
Set tbl = Sheets("Master Input").ListObjects(1)
Set rw = tbl.ListRows.Add.Range
Sheets("Data").Range("CF2:KX2").Copy rw
End Sub
The code copies a fully formatted blank row within a range (CF2:KX2) located on a separate tab and pastes the row to the bottom of the table. It works well whilst the table is unfiltered or sorted, but when the user tries to apply multiple column filters, they get a Runtime error "1004".
Is there a way to add a new row despite any heavy filtering?