+ Reply to Thread
Results 1 to 4 of 4

VBA script to parse string variables in column

  1. #1
    Registered User
    Join Date
    04-19-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    VBA script to parse string variables in column

    Hi Everyone,

    I've researched to the point of needing help now. Any help would be appreciated.

    I have a column that is called Options with a string of words (a chunk of HTML really). In this column I want to parse through each cell and look for each of the following variables:

    Draw Hand: (Right,Left)
    Draw Weight: (x)
    Draw Length: (in half inches)
    Arrow Length: (in half inches)

    If any of those variable strings are in the cell, then I want them placed in a separate column in the spreadsheet.

    Spreadsheet here at Google Docs:

    I would ideally like to have a VBA script that is flexible to add more variable strings as needed. Many thanks for your help!

    Kind Regards,
    Justin

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

    Re: VBA script to parse string variables in column

    I like to use normal worksheet formulas to do the brunt of the work, so you can run this macro without the last two lines of code to see the formulas that are created. It might work as is if you simply add another column and copy the formula from column F over...
    Please Login or Register  to view this content.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    04-19-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: VBA script to parse string variables in column

    Well done Jerry! Thank you for helping me with this. Does anyone have any thoughts on how we could automatically clean up the data once its been parsed into the new fields? Would like to continue working in the script Jerry has framed up to this point.

    Here's how the data looks after its been parsed:
    Please Login or Register  to view this content.
    For the columns the fields should allow for:
    Draw Hand: (Right, Left) - 5 char max
    Draw Weight: (60) - 2 char max
    Draw Length: (28.5) - 4 char max
    Arrow Length: (27.5) - 4 char max
    Arrow Size: (3000) - 4 char max
    String Length: (104) - 3 char max


    Current VBA script:
    Please Login or Register  to view this content.
    Thank you,
    Justin

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

    Re: VBA script to parse string variables in column

    Here you go:
    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