+ Reply to Thread
Results 1 to 9 of 9

Need a macro for separating data in a worksheet

  1. #1
    Registered User
    Join Date
    07-10-2013
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    4

    Need a macro for separating data in a worksheet

    Hi,

    im new to the forum so dont laugh if this is a really simple problem! I have a macro set up to import 4000 text files into worksheet but they all insert into 1 column. I need each data set in a new column (each set is 46 rows).

    I was wondering if somebody could help me with a macro which will select each data set and paste it into the next free column therefore having 46 rows from row 6 to row 52.

    This would be much appreciated as ive spent at least 6 hours trying to make it work!

    Thanks

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Need a macro for separating data in a worksheet

    I think you may need to upload an example workbook. It sounds like a simple Text to Columns procedure but without seeing the data it is a guessing game.

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Need a macro for separating data in a worksheet

    I assume you use a macro along these lines to import your text files so with a slight modification of the destination using cell coordinates should work.

    Please Login or Register  to view this content.
    You will have to "Dim i as An Integer"

    Your problem will be importing values from 4000 text files as excel 2003 (your profile says Excel 2003) has a limit of 256 columns. Excel 2007 on the other hand should be able to handle 16000.

    Alf
    Last edited by Alf; 07-10-2013 at 02:12 PM. Reason: added info

  4. #4
    Registered User
    Join Date
    07-10-2013
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need a macro for separating data in a worksheet

    example.xlsm

    Hope this helps!

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Need a macro for separating data in a worksheet

    Hello charlotteparr,

    Welcome to the Forum!

    To help develop a solution, yyou should also post a text file that be used for testing.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Registered User
    Join Date
    07-10-2013
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need a macro for separating data in a worksheet


  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Need a macro for separating data in a worksheet

    Hello charlotteparr,

    I have added the macro below to the attached workbook. the code is in Module2.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-10-2013
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need a macro for separating data in a worksheet

    Works perfectly

    thank you so much! i can see where i was going wrong now!

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Need a macro for separating data in a worksheet

    Hello charlotteparr,

    You'er welcome. If you have any questions about the code, just ask. I will be happy to explain.

+ 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