+ Reply to Thread
Results 1 to 2 of 2

Referencing Delimiters

  1. #1
    Registered User
    Join Date
    06-13-2011
    Location
    Boulder, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    61

    Referencing Delimiters

    Hey all,

    I have a tab delimited workbook which I am trying to write a macro for in order to speed up the data analysis process. In the document, the data for each trajectory is separated by spaces. In my net calculation, I use the following equation:

    SQRT[(x2-x1)^2+(y2-y1)^2]

    In order for this calculation to be a net distance versus and average distance x1 and y1 need to always be the first entry of each trajectory. However, I am a little confused on how to write the code so it can apply to all of the trajectories and reference the first data point for the respective trajectory and assign this to be x1 and y1. The way I have done this in python was by telling the code to start with the first entry below the delimiters %% unfortunately I am not sure if there is a way to do this in VBA or not. I've attached my workbook with the macro I'm currently edited. I know this can be somewhat confusing as it's not the easiest thing to explain so if I'm not being clear enough please feel free to ask questions.
    Attached Files Attached Files
    Last edited by Impartial Derivative; 06-23-2011 at 01:55 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Referencing Delimiters

    this is a intermediate reply
    see the attached xlsm(this is excel 2007 macro enable file). I hope you know how to deal with macro enable files (.xlsm)
    I kept the original yoyo sheet as "yoyo original" and copied columns A to F to another sheet yoyo.

    now see sheet 'yoyo".it is after running the macro "test" below.

    for retesting first run the macro "undo" and then run "test"

    and see what happens.in column G.
    I suppose this is what you want for column G

    the logic is
    1.first find first trajectory
    2.define range from one cell below "trajectory" till the end of that set that is from
    B2 to B16 and calculate the formula for each of the Bs in the set and park it in the corresponding cell in column G
    3. then find next "trajectory" and do the same thing
    4. till you get the last trajectory.

    go through the macro you can understand the full logic.

    can you write other subs on the same line for other columns on the same basis and collate all the macros together in a finalmacro.

    the macros are (which is also in the vb editor of the file)


    I shall be busy next week as I am relocating. so if there is any bug or doubt you have to wait for a week. or so. sorry for this.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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