First I apologize for the long post that will probably need even FURTHER information that I didn't realize I need to include. Complete newbie & I have been researching this all day & have seen numerous posts with solutions for things "similar" to what I need. The problem is I've never even looked at VBA before today & I don't understand the code enough to modify it for my needs. I think some of the problem is also that I am working in an excel file that was poorly constructed before I took over managing it. I have attached the file with sensitive info removed for reference. The file is a list of short sales active with my company, grouped by branch, all on one sheet. I am looking for a macro that will dynamically select the rows for each branch & then apply a custom sort with 4 levels in the order: 1. Column K (A-Z), 2. Column J (Newest to Oldest) 3. Column I (Newest to Oldest) & 4. Column F (Newest to Oldest). For example, in my file the first branch, 2333, consists of rows 7-42.
I taught myself Dynamic Named Ranges today & was able to to create the most simple macro in the world to highlight the rows for the first branch (Branch 2333) using named range "_2333":
but the next step of applying the custom sort is where I get lost. I recorded a macro where I selected the data in the named range "_2333" then applied the custom sort & this is what it returned:![]()
Please Login or Register to view this content.
The problem with that code is it's using the static ranges instead of the dynamic named range. This doesn't work considering I'm constantly adding rows to the list. When I attempted to replace all the ranges in the above code with my dynamic named range "_2333" to get this:![]()
Please Login or Register to view this content.
I get the following message: "Run Time Error '1004': The sort reference is not valid. Make sure that it's within the data you want to sort, and the first Sort By box isn't the same or blank."![]()
Please Login or Register to view this content.
When I hit Debug it Highlights ".Apply".
I may even be going about this completely wrong & there might be a much better way of approaching it I just don't know enough about macros. Any help would be HUGELY appreciated.
Bookmarks