Announcement

Collapse
No announcement yet.

Inserting text seperated by commas.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Inserting text seperated by commas.

    Can someone please help me with this issue. I need to insert text seperated by commas into excel. Text goes something like this:

    go,back
    run,hide
    jump,dive
    etc.....

    I need to insert the text so that go, run and jump are in column 1 and back, hide and dive are in row two. I used to know how to do this but I forgot.

    Thanks,
    Ron

  • #2
    Re: Inserting text seperated by commas.

    In VB this code inserts text (comma delimited) file into new worksheet:

    Code:
    Set ws = Worksheets.Add
    '/Importing text file:
        '/get file name from user
        sFile = Application.GetOpenFilename( _
            fileFilter:="CSV (comma delimited) (*.csv), *.csv, Text Files (*.txt), *.txt, All Files (*.*), *.*", FilterIndex:=1, _
            Title:="Copy Text File To Worksheet")
        If sFile <> False Then
            
          '/Import
            Workbooks.OpenText Filename:=sFile, Comma:=True
     '\import text to temporary worksheet
            ActiveSheet.UsedRange.Select    
    '/select imported text in temporary workbook
            Selection.Copy                  '/copy to clipboard
            ActiveWorkbook.Close            '/close temporary workbook
            
            ws.Range("A2").Select
            ActiveSheet.Paste
            m = ActiveSheet.UsedRange.Columns.Count
            n = ActiveSheet.UsedRange.Rows.Count
                           '/paste text into your workbook
        End If
    Without VB, just go to menu>data>get external data>import text file

    Comment


    • #3
      Re: Inserting text seperated by commas.

      Few ways, either open the txt file from excel and you should start the wizard that will allow you to specify how you want to treat the data.

      Have a look at DATA>>>GET EXTERNAL DATA>>>IMPORT TEXT FILE

      Or paste it in and then look at the DATA>>>TEXT TO COLUMNS option..

      D

      Better a bad day on the water than a good day in the office

      Comment


      • #4
        Re: Inserting text seperated by commas.

        Do you mean you have text in comma separated values format, ie each cell contains say run,jump - etc?

        If so you can use Text to Columns from the Data Menu and select comma as the delimiter
        Hope that Helps

        Roy

        New users should read the Forum Rules before posting

        For free Excel tools & articles visit my web site

        If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

        RoyUK's Web Site

        royUK's Database Form

        Where to paste code from the Forum

        About me.

        Comment


        • #5
          Re: Inserting text seperated by commas.

          This "Have a look at DATA>>>GET EXTERNAL DATA>>>IMPORT TEXT FILE" works great!!! Thanks alot guys!

          Ron
          Last edited by forumwatcher; July 29th, 2006, 12:11.

          Comment

          Working...
          X