VBA - Sorting Formula has stopped working

  • It should not be there. The code is putting the value into the 13th column of the new row.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Yes I took the 1 off of Value and it is placing the information on the wrong line and also information that is already on that line. The purpose of this UserForm is to search/Filter through the "Parts List" sheet by Req Number and place the associated PO Number and date entered with all lines that include the that Req Number

  • Your code adds a new row to the table and populates that. There is no "information already on that line" since it's a new line (other than any table formulas that fill down).

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Your code adds a new row to the table and populates that. There is no "information already on that line" since it's a new line (other than any table formulas that fill down).

    Thats my point. First off its not my code that is what someone at the beginning of this post placed in there and I am new at this. they changed my code and said I was doing it work for a Table. So I asked how I should be doing this and that was the code they inserted. I don't need a new line I need the information to be placed along with all the lines that has the same associated Req number that was selected from the drop down list.


    This is the Original Code that was causing me issues in the first place.


  • The original code works as long as there is more than one item in on the "parts list" sheet. If I have multiple Req's in there it works perfect but if there is only one in there just like the first example I attached in first post, then it freaks out and places the PO number into literally every cell in the sheet and overloads the workbook till it runs out of memory.

  • If you use Specialcells on a single cell range (which is what happens when you have one row of data), it is applied to the entire worksheet. You need to test if Last = 3, and if it is, test if row 3 is hidden, instead of using SpecialCells.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • If you use Specialcells on a single cell range (which is what happens when you have one row of data), it is applied to the entire worksheet. You need to test if Last = 3, and if it is, test if row 3 is hidden, instead of using SpecialCells.

    How can I test this...I'm sorry I am New to VBA Code?

    • Best Answer

    Something like this:


    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • That worked perfectly!


    thank you so much!


    I was trying to write it out myself and I was on the right track, but I was still doing it wrong. So thank you for taking the time to write it out for me. Once I see it then it all makes sense.


    I am a PLC Ladder logic programmer and have no experience with Structured text so VBA is New to me and I thank you for all your help :!:

Participate now!

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