+ Reply to Thread
Results 1 to 8 of 8

Parsing Out Excel Data to a new Worksheet

  1. #1
    Registered User
    Join Date
    02-26-2007
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    2007
    Posts
    22

    Parsing Out Excel Data to a new Worksheet

    OK, so I am starting to realize that what I am trying to do may be a bit over my head. I will describe it below and if anyone can help that would be great.

    I have two worksheets "Gary Breakout" and "Macro List" in a workbook.

    To help understand what I'm trying to do lets say "Gary Breakout" contains a list of names of students and there 100 meter sprint times. The students names are found in Column "C" There first 100m time is found in column "D" and there additional times are found in columns "F:S"

    Some students have recorded up to 15 times, other students only 1 or 2. I am trying to create a macro the will copy the students name and there time(s) to a new worksheet. Of course there is the added issue of not all of them recording 15 different times, so some students will take up only 1 row in the new sheet, others 15.

    In Column "B" I added a counta formula to count the number of times they have recorded a time "=COUNTA(E2:S2)"

    With limited VBA knowledge I am trying to create a macro that will loop through all rows in "Gary Breakout" and based on the value in column "B" insert the appropriate number of rows into "Macro List" and copy the students name into column "A" of "Macro List" and there time(s) into column "B"

    I hope this all make sense. If anyone can help it would be greatly appreciated.
    Last edited by outthere; 08-26-2009 at 11:32 AM. Reason: solved

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Parsing Out Excel Data to a new Worksheet

    I suggest you attach a sample workbook, including desired results.

  3. #3
    Registered User
    Join Date
    02-26-2007
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    2007
    Posts
    22

    Re: Parsing Out Excel Data to a new Worksheet

    Attached is the sample sheet. The actual data I am dealing with is not a time value so I just put random letters in as the data. The worksheet titled "RESULTS NEEDED" is what I need to see in "Macro List"

    Thanks again for the help.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    10-08-2006
    Location
    Walnut, CA
    MS-Off Ver
    2003,2010, Office 365
    Posts
    114

    Re: Parsing Out Excel Data to a new Worksheet

    Hi,
    Try this
    Please Login or Register  to view this content.
    Tony

  5. #5
    Registered User
    Join Date
    02-26-2007
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    2007
    Posts
    22

    Re: Parsing Out Excel Data to a new Worksheet

    Wow, thanks Tony.

    I had to remove the "-1" from the end of:

    Please Login or Register  to view this content.
    As it was dropping the first character of the data that was needed but other than that it works great. Thank you so much!!

    I did notice that i only works if i run it from the "Gary Breakout" worksheet. Is there a way to change that? no big deal if not.

    Thanks again!

  6. #6
    Forum Contributor
    Join Date
    10-08-2006
    Location
    Walnut, CA
    MS-Off Ver
    2003,2010, Office 365
    Posts
    114

    Re: Parsing Out Excel Data to a new Worksheet

    Hi,
    You're welcome.
    Just add the following line to the beginning of the sub
    Please Login or Register  to view this content.
    Tony

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Parsing Out Excel Data to a new Worksheet

    Gentlemen, a tip of the day to keep things operating optimally. Whenever you declare a variable without a category, Excel defaults to the most expensive category of all, VARIANT. Mostly, I suppose that's fine, but as a general rule you want to qualify your variables to the least expensive and accurate category.

    For loops, rows, columns, the safest choice is LONG as it only allows whole numbers and up to 2.4 million of them in Excel 2003, so plenty of room without teh expense of VARIANT. So declare them fully at the top like so:
    Please Login or Register  to view this content.
    ========
    OutThere, if that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].

    Also, be sure to fill out your profile so people will be able to see what version of Excel you're using without having to ask all the time.

    (Also, use the blue "scales" icon in our posts to leave Reputation Feedback, it is appreciated)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  8. #8
    Registered User
    Join Date
    02-26-2007
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    2007
    Posts
    22

    Re: Parsing Out Excel Data to a new Worksheet

    Thank-you both so much for the help. I will change the post to solved and of course I added to both your reputations

    Gary

+ 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