I wrote the below code in VBA to delete full rows if, in column U of Sheet21 (actually named "ROG Registration") if "Self Cancelled" or "Waitlisted" appear. When I'm on the ROG Registration tab with the VBA window open and run this it works perfectly.
I have a separate tab with macro buttons and I assigned this macro to the form control button, but when I click on the button nothing happens.
Any idea why? Could it be that I need to use the "ROG Registration" name within the code? ".Select" the tab first since it's on a different tab than the button?
Sub ROG_DeleteRows() Dim r As Integer For r = Sheet21.UsedRange.Rows.Count To 1 Step -1 If Cells(r, "U") = "Self Cancelled" Then Sheet21.Rows(r).EntireRow.Delete ElseIf Cells(r, "U") = "Waitlisted" Then Sheet21.Rows(r).EntireRow.Delete End If Next End Sub