+ Reply to Thread
Results 1 to 16 of 16

Sort data into another workbook

  1. #1
    Registered User
    Join Date
    08-14-2017
    Location
    Belgium
    MS-Off Ver
    365
    Posts
    48

    Sort data into another workbook

    Ok,
    I have 2 files.
    - HOME.xlsm
    - Has several tabs (01, 02, 03, 04, 05,... they are all blanco)
    - INPUT.xlsx
    - Has 1 tab calles "Sheet1".

    In "Sheet1" there is some data. In the first column there is a always a number between 1 and ....

    Whats I need is:

    Import all rows that start with a "1" from "Sheet1", to "HOME" into tab "01"
    Import all rows that start with a "2" from "Sheet1", to "Home" into tab "02"
    Import all.....

    and so on...

    The only numbers that can be in the first column of "Sheet1" are from 1 to 6 and from 21 to 30. (not sure if this info is needed)
    All tabs in "HOME" are already made.


    Thanks a lot!!
    Greetings from Europe, Belgium, Antwerp.

  2. #2
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Re: Sort data into another workbook

    This seems relatively simple but can you attach a couple of sample workbooks please.

  3. #3
    Registered User
    Join Date
    08-14-2017
    Location
    Belgium
    MS-Off Ver
    365
    Posts
    48

    Re: Sort data into another workbook

    I hope the attachments are visible.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-14-2017
    Location
    Belgium
    MS-Off Ver
    365
    Posts
    48

    Re: Sort data into another workbook

    Input = import

  5. #5
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,962

    Re: Sort data into another workbook

    ..................deleted................
    Attachments uploaded....
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  6. #6
    Registered User
    Join Date
    08-14-2017
    Location
    Belgium
    MS-Off Ver
    365
    Posts
    48

    Re: Sort data into another workbook

    @Sintek, I prefer not to send a file of what it should look like... too much work. Just sort the lines and write them in the correct Tab of the HOME workbook. The whole line,... if it's not clear, off course I send you what it should look like.

    Anyway, Thx for the fast reply.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Sort data into another workbook

    Place both files in the same folder and Run the code from Home.xlsm.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-14-2017
    Location
    Belgium
    MS-Off Ver
    365
    Posts
    48

    Re: Sort data into another workbook

    Error on:
    Set rs = cn.Execute("SELECT * FROM [Sheet1$] WHERE F1 = " & Val(ws.Name))

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Sort data into another workbook

    Working here.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    08-14-2017
    Location
    Belgium
    MS-Off Ver
    365
    Posts
    48

    Re: Sort data into another workbook

    I'll send you the original files then... perhaps because I placed into an existing code.
    Its still a work in progress...

    In this example SeasonalityCheck = HOME

    Already thanks a lot for the help.

    PS, I know the file will probably won't work, due alle the links to files on my X drive.
    Attached Files Attached Files

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Sort data into another workbook

    Change to
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    08-14-2017
    Location
    Belgium
    MS-Off Ver
    365
    Posts
    48

    Re: Sort data into another workbook

    AWSOME!!

    Now to make it a bit more complex,

    If I want to import only column A, B, C end D (so if I put some formulas in E, F, G they not get over written)

    Thx!!

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Sort data into another workbook

    Just change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Re: Sort data into another workbook

    not the way I would have done it, but this is pretty impressive. guess I'm gonna go research ADODB connections and a little SQL.

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Sort data into another workbook

    Quote Originally Posted by Kramxel View Post
    guess I'm gonna go research ADODB connections and a little SQL.
    It will be a very strong tool for you, and thanks for the rep.

  16. #16
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Re: Sort data into another workbook

    You're right it is - only palyed around with a few basic examples but loving it so far and you're welcome.

+ 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. [SOLVED] Auto sort data from another workbook
    By Zipping2010 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-25-2016, 05:32 PM
  2. copy data to new workbook & sort data into different categories if criteria match
    By natnauk16 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2013, 03:53 AM
  3. Macro to sort data,match and paste in to relevant sheets on same workbook
    By Benjamin2008 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-08-2009, 07:58 AM
  4. Merging Data from differnet workbook & Sort by colour
    By whousedmy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-24-2009, 10:43 PM
  5. Replies: 1
    Last Post: 07-28-2006, 11:10 AM
  6. sort source workbook data, maintain formulas in destination workb.
    By jfb191 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-23-2006, 06:10 PM
  7. How do I sort data from various worksheets in the same workbook i.
    By Evelyne in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-01-2005, 02:06 PM

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