+ Reply to Thread
Results 1 to 3 of 3

vba code to create a list from data in one field

  1. #1
    Registered User
    Join Date
    03-27-2005
    Posts
    59

    vba code to create a list from data in one field

    is their any code that create a list of sperate words in individual fields based on the data in one entire field, for example
    if i have the words "dog 1 cat 2" in one cell (A1) is there a way to create code to take those words and in cell a2 place dog, a3 place 1, a4 place cat and a5 place 2?
    any help is much apprechiated thanks

  2. #2
    Forum Contributor wmorrison49's Avatar
    Join Date
    09-25-2007
    Posts
    267
    I just typed in "dog 1 cat 2 mouse 3" into cell A1, selected the entire column, and did Text to Columns using space as the seperater and recorded it. This is what it looked like:

    Columns("A:A").Select
    Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
    TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
    Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
    :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1)), _
    TrailingMinusNumbers:=True
    You can give that a try

  3. #3
    Registered User
    Join Date
    03-27-2005
    Posts
    59
    worked a treat, many thanks

+ 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