+ Reply to Thread
Results 1 to 9 of 9

VBA to move text strings to proper Column

  1. #1
    Registered User
    Join Date
    06-08-2012
    Location
    South Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    20

    VBA to move text strings to proper Column

    Hi-
    I am hoping some one could help me.

    I have Genealogy data in an excel file in one column like this.

    Alan Hageman
    Birth: 28 Aug 1953 in Evanston, Cook County, IL
    Marriage: 03 Mar 1979 in DeKalb, DeKalb County, IL
    Alan Koch
    Birth: Unknown
    Marriage: Unknown
    Albert August Haseman
    Birth: 03 Nov 1870 in Park Ridge, Cook County, IL
    Marriage: 1895
    Death: 03 Feb 1944 in Arlington Heights, Cook County, Illinois, USA
    Cemetery: 30 Jan 2004 in Maine Township Cemetery
    Burial: 07 Feb 1944 in Park Ridge, Cook County, IL
    Burial Plot: 17 Dec 2002 in Burial plot information: Block 122
    Albert Carl Friedrick Franz Maas
    Birth: 29 Oct 1887

    I would like the data to format like this in 7 seperate columns.
    Name Birth Death Marriage Burial Cemetery Plot
    Name 1 Birth1 Death 1 Marriage 1 Burial 1 Cemetery 1 Plot 1
    Name 2 Birth 2
    Name 3 Birth 3 Death 3


    I have 8000 lines, and the Birth:, Death:, Marriage:, etc, designator always precedes the data.

    Is this possible or am I doomed by copy/pasting or dragging and dropping to the appropriate column?

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA to move text strings to proper Column

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-08-2012
    Location
    South Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: VBA to move text strings to proper Column

    Thank you for your post.

    I copied your script to the VB under Modules 1

    I run the script and get an error at InfoVal = Split(Cell.Value, ": ")(1)

    This is my edited script, did i miss a variable? The error is Run-time Error 9
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA to move text strings to proper Column

    Hard to say without seeing your workbook. But if you're getting an error on that line, it seems to suggest you have a cell that has a colon and space with nothing after it, like "Example: ". I say that because if the previous line ran w/o error, there would have to be a colon and space in the cell.

  5. #5
    Registered User
    Join Date
    06-08-2012
    Location
    South Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: VBA to move text strings to proper Column

    Your Suggestion was correct. I found a blank value after a colon. in fact I corrected that one and found more. Once I cleaned the blank data-set out of the list it ran flawlessly. Ironically, those blanks was why I wanted to create this report in the first place.

    Your help was very much appreciated. You saved me hours of work, which I can now focus on actual research time.

  6. #6
    Registered User
    Join Date
    06-08-2012
    Location
    South Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: VBA to move text strings to proper Column

    Your Suggestion was correct. I found a blank value after a colon. in fact I corrected that one and found more. Once I cleaned the blank data-set out of the list it ran flawlessly. Ironically, those blanks was why I wanted to create this report in the first place.

    Your help was very much appreciated. You saved me hours of work, which I can now focus on actual research time.

  7. #7
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA to move text strings to proper Column

    Glad to help. We could account for those blank values in the code if you want, but i'm guessing you really only needed to run this code once anyway.

    Please mark this thread as SOLVED, and any reputation (the * in the lower left of my posts) would be much appreciated.

  8. #8
    Registered User
    Join Date
    06-08-2012
    Location
    South Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: VBA to move text strings to proper Column

    I will probably re-run this with a new list sometime in the future once I begin to fill in blanks. Having that issue is actually a good thing. It allows me to clean up missing data, now that I know what the error means.

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA to move text strings to proper Column

    Maybe:

    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)

Similar Threads

  1. Replies: 2
    Last Post: 01-15-2014, 09:31 AM
  2. Extract data from text strings and move to new column
    By FN2010 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-13-2010, 03:59 AM
  3. If Cells equal text strings then move to specific ranges
    By FN2010 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-13-2010, 12:26 AM
  4. Replies: 2
    Last Post: 11-24-2008, 05:09 PM
  5. proper mid len if find or if mid?!, EASY-consolidate 2 diff strings
    By DoraExplorExcel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-22-2007, 11:15 AM

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