+ Reply to Thread
Results 1 to 15 of 15

Sorting and deleting

  1. #1
    Registered User
    Join Date
    11-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Unhappy Sorting and deleting

    Hello,

    I work with 3D Autocad Inventor software, every time we finish a project, we export BOM in excel format. This BOM has all parts even the ones we don`t need, so every time I need manually delete parts that start with P and R letters in their name.
    Is there any way I can automate this process using VB?

    Is this doable?

    Thanks,
    Alex.
    Attached Files Attached Files
    Last edited by achmidt; 11-16-2011 at 02:17 PM.

  2. #2
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Sorting and deleting

    If your names are in column D use this
    Please Login or Register  to view this content.
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  3. #3
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Sorting and deleting

    hello,
    do you want to delete complete row which has "P" or "R" in Item, description,material,stock ?

  4. #4
    Registered User
    Join Date
    11-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Sorting and deleting

    Tom, I`m so sorry I`m a not really familiar with VBA, can you tell me where to add and how to call this sub in my spread sheet?

  5. #5
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Sorting and deleting

    press Alt + F 11 then insert module past my code and e.g. press F5

  6. #6
    Registered User
    Join Date
    11-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Sorting and deleting

    Awesome! Thank you so much!!!

  7. #7
    Registered User
    Join Date
    11-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Sorting and deleting

    Do you guys know if it is possible to sort automatically 1,2,3 etc after running "aa" sub?

  8. #8
    Registered User
    Join Date
    11-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Sorting and deleting

    Quote Originally Posted by shaukat View Post
    hello,
    do you want to delete complete row which has "P" or "R" in Item, description,material,stock ?
    Yes, delete complete row. Script above from Tom was what I needed. Thank you. Looking for how I can sort parts now.... do you know?

  9. #9
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Sorting and deleting

    I am not sure I understand but if you want have numbers in column A like 1,2,3 etc try this:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    11-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Sorting and deleting

    Quote Originally Posted by tom1977 View Post
    I am not sure I understand but if you want have numbers in column A like 1,2,3 etc try this:

    Please Login or Register  to view this content.
    Tom please see attached file. After you run the macro ( I modified it a little bit) if you look at Item column you`ll see it starts from #3. I`m wondering how to assign Item #`s so #3 becomes #1 and so on...?
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Sorting and deleting

    Quote Originally Posted by tom1977 View Post
    I am not sure I understand but if you want have numbers in column A like 1,2,3 etc try this:

    Please Login or Register  to view this content.
    sorry wrong excel spreadsheet . the one attached is correct....
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Sorting and deleting

    try this code:
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    11-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Sorting and deleting

    Genius!!! Thanks! Tom, at the risk of being a huge pain, do you mind if I`ll ask few more questions?

    1. How to format cells and add borders automatically ? see test3
    2. Is there any way to adjust break view so when I print it prints the entire sheet? see test3

    BOM can be 10 rows long or 200 rows long.
    Please see
    test2.xls - after running macros and VB script
    test3.xls - that what I need to be done in addition.

    Thanks in advance!
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Sorting and deleting

    for borders use this:

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    11-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Sorting and deleting

    figured out how to do break_page

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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