Help Debugging long sorting, labeling and highlighting macro

  • Hi - I keep trying to fix this macro and feel like I am making things worse. At my wits end.. any help would be appreciated with just looking and pointing out things you know for a fact are going to throw errors...

  • Re: Help Debugging long sorting, labeling and highlighting macro

    2nd part of code..

  • Re: Help Debugging long sorting, labeling and highlighting macro

    Your post is a very good example of how not to post on a board like this.

    You say "I keep trying to fix this macro" but you don't say what the issue(s) are.
    You attach an XLSX workbook which cannot contain code.

    If anyone was to attempt to help, they'd have to download the workbook, copy/paste the code (from the looks of it, about 450 lines) and then edit it to get rid of any extra text from the message before running the code and dealing with any compile issues and only then trying to figure out what your problems are - and odds on whatever they might find will be something you haven't even come across.

    You would increase your chance of getting some help if you upload a complete, working XLSM file, invest some time explaining clearly what the problems are and what it is you want the code to do.

    The only advice I would give is get rid of the

    On Error Resume Next

    statements and correctly deal with any errors that do get raised; including potential errors like a filter not returning any rows, rather than just ignoring them. Errors will compound upon errors leaving you completely lost by the time it actually falls over - and when it does the eventual error will completely mask the initial problem that started the error cascade.

  • Re: Help Debugging long sorting, labeling and highlighting macro

    Okay. Sorry about that. Attached is the document with the code.

    I am getting an error at line 126 - Invalid procedure call or argument

    What I am trying to do at that point is filter out the data and input text into the visible cells in column AJ depending on the filtering..


    ActiveWorkbook.Sheets("Sheet2").ListObjects("Table").Range.AutoFilter Field:=23, Criteria1:="<>"    ActiveWorkbook.Sheets("Sheet2").ListObjects("Table").Range("$AJ$").SpecialCells(xlCellTypeVisible).FormulaR1C1 = "Complaint Sent To Court - Not Filed"

    Here, I am filtering on column 23 and if it not blank, I am putting in "Complaint Sent To Court - Not Filed" - for everything that is visible. At the end of all of this i am going to create a pivot using the descriptions from column AJ.

    I have attached a better example doc, with the code.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!