+ Reply to Thread
Results 1 to 10 of 10

Vba sorting and deleting

  1. #1
    Registered User
    Join Date
    06-25-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    9

    Vba sorting and deleting

    This is my first post and I apologize if its long, I am a novice in regards to writing code so bear with me. I have a monthly report I run that is over 56,000 rows and 16 columns of information. Not all of this data pertains to what I need so I'm looking for help on a quick sort so I don't spend hours each month combing through this thing. I'm needing to narrow the WHSE column down from over 1,000 to 118 and delete the rest. I then need to sort it by the Reason Codes that I need and delete the rest. I tried exporting it into a pivot table but it is too much information. I tried creating a macro and filtering the data I need but not every WHSE is on the list each month and it wouldn't let me filter two columns worth. I have read about writing code in VBA but I am lost at this point due to the amount of data.VBA help.xlsx I have attached a verison with the relevant sort information.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Vba sorting and deleting

    I am afraid your explanation of what you need is very vague.

    Your data is very repetitive. Do you want us to delete the duplicates?

    Do you need to know how many duplicates of each type we deleted?

    People usually provide before samples so we know how to proceed,
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Vba sorting and deleting

    Since you didn't identify your filtering and sorting parameters you will need to modify this code for your specific use.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-25-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    9

    Re: Vba sorting and deleting

    My apologies on the vagueness. I pulled the rest of the information out since it pertains to pricing. This pulls information from over 1000 of our branch locations that we service company wide. I need to filter it down to the 118 that I service in my region. Secondly I need to sort it by the different Reason codes that I am looking for. Here are the WHSE numbers I am looking for:30,61,62,63,68,86,88,97,170,190,191,192,206,216,230,242,244,245,296,333,360,379,434,454,455,456,470,480,481,483,484,485,486,526,545,555,582,653,658,710,728,768,787,788,789,861,903,904,909,959,1006,1018,1105,1106,1107,1108,1109,1116,1117,1130,1160,1171,1184,1211,1224,1232,1241,1248,1254,1263,1311,1318,1319,1398,1475,1563,1570,1594,1611,1744,1746,1762,1767,1770,1773,1832,1847,1869,1895,1931,1933,1975,1998,2026,2064,2070,2075,2470,2570,2572,2705,2716,2725,2735,2755,2759,2770,2779,2781,2784,2924,3081,3111,3133,3172,3173,3208

    The reason codes that I need filtered are CM, DC, FM, and MM

    Thank you for your quick responses and for the help, it is greatly appreciated!!!!

  5. #5
    Registered User
    Join Date
    06-25-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    9

    Re: Vba sorting and deleting

    Is there a way to just sort by the WHSE numbers I need then delete everything that is left?

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Vba sorting and deleting

    Is there a way to just sort by the WHSE numbers I need then delete everything that is left?
    Yeah just filter for those values then copy to a new sheet. I will see what I can work up here.

    Edit:
    Please Login or Register  to view this content.
    Last edited by stnkynts; 06-25-2015 at 02:03 PM.

  7. #7
    Registered User
    Join Date
    06-25-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    9

    Re: Vba sorting and deleting

    This report captures all of the adjustments that a branch makes for a given timeframe. My concern with the filter is that a branch may not have made an adjustment this month so they will not be captured when filtered but they may make one next month. Will it still be captured or do I need to enter all of the WHSE numbers that I know I need to search for so it will capture them when I run this again next month?

  8. #8
    Registered User
    Join Date
    06-25-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    9

    Re: Vba sorting and deleting

    So in all of my infinite wisdom I deleted a bunch of rows that contained sensitive data per our company's SOP. In doing this it makes it really hard for others to help out when they don't have all of the information. My Rows run from a to Q with the WHSE sort in Row C and the Reason sort in Row E. For the life of me I couldn't figure out why it was only doing the first two rows. I tried various combinations with your code to capture all of the cells needed but it either turned up nothing or I timed out and sent to debug. I need what you did but sorted on Row C and Row E not A&B like in the original attachment. What are your suggestions stnkynts? I apologize for all of the questions but you are a life saver right now!!!! Thank you!!!!

  9. #9
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Vba sorting and deleting

    Rows are numerical, columns are alphabetical. I will assume you mean Column C and Column E.

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    06-25-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    9

    Re: Vba sorting and deleting

    This worked perfectly, thank you for all of your help. This will eliminate hours of frustration on my part!!!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need Help Sorting and Deleting Duplicate Data
    By superdrno in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2014, 03:04 PM
  2. [SOLVED] Sorting and deleting
    By flunzy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2013, 10:55 AM
  3. [SOLVED] Sorting and deleting rows
    By Lotrking1010 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-09-2012, 09:14 PM
  4. Sorting and deleting
    By achmidt in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-16-2011, 02:19 PM
  5. sorting and deleting sheets
    By Spike in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-16-2006, 11:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1