I have a macro to remove specific undesired data from my spreadsheets data tab. I'm a major amateur with VBA so I'm sure my macro could probably be better but first it removes duplicates based on 3 criteria from the table, next it filters 3 columns and deletes every row of data based off said filters, clears all the filters and prompts a completed message box once the macro has finished running.
Is there any way to add to the message box or create a user form that will return the actions that were completed (# of duplicates removed, # rows deleted, etc)?
I know when you just use the duplicate removal function from the data tab it will alert to as to how many were removed and how many rows remain.
Here is my newbie script;
Sub Del_Dups_and_Remarks()
' Del_Dups
Application.ScreenUpdating = False
Range("DenialsTable1[[#Headers],[Payment Tx ID]]").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Range("DenialsTable1[#All]").RemoveDuplicates Columns:=Array(2, 6, _
14), Header:=xlYes
' Remark_Removal
ActiveSheet.ListObjects("DenialsTable1").Range.AutoFilter Field:=19, _
Criteria1:="=MEDICAID [239]", Operator:=xlOr
ActiveSheet.ListObjects("DenialsTable1").Range.AutoFilter Field:=22, _
Criteria1:="Y"
ActiveSheet.ListObjects("DenialsTable1").Range.AutoFilter Field:=9, _
Criteria1:="N598"
Application.DisplayAlerts = False
Range("DenialsTable1").Offset(1, 0).Select
Selection.Delete
Application.DisplayAlerts = True
'Clear_Filters
Range("A6").Select
ActiveSheet.ShowAllData
Range("A7").Select
Application.ScreenUpdating = True
MsgBox ("Completed")
End Sub
Thank you so much in advance!