Results 1 to 2 of 2

Help with VBA import coding

Threaded View

potterotter Help with VBA import coding 06-11-2014, 06:22 AM
arlu1201 Re: Help with VBA import... 06-25-2014, 07:11 AM
  1. #1
    Registered User
    Join Date
    03-26-2014
    MS-Off Ver
    Excel 2013
    Posts
    31

    Help with VBA import coding

    Please take a look at the attachments. I would like to import the .csv file into excel using VBA and have written the code. It is not working exactly as planned.

    Ultimately I would like to have the ID in column A, Last name in B and First name in C.

    Currently, my ID and First Name is combined in Column A which is not what I want. Also it doesn't seem to loop.

    Thanks!

    
    
    Sub importingtextfile()
    
        Dim Filepath As String
    
        Filepath = "C:\Users\dchao\Desktop\VBA Test\authors.csv"
        Open Filepath For Input As #1
        ActiveSheet.Cells(1, 1).Select
            row_number = 0
        
            Do Until EOF(1)
                Line Input #1, LineFromFile
            
                lineitems = Split(LineFromFile, ",")
               
                
                ActiveCell.Offset(row_number, 0).Value = lineitems(2)
                ActiveCell.Offset(row_number, 1).Value = lineitems(1)
                ActiveCell.Offset(row_number, 2).Value = lineitems(0)
                    
                row_number = row_number + 1
            
            Loop
        Close #1
        
            
        
    End Sub
    authors.csv
    vbatestfile.xlsm
    Last edited by potterotter; 06-11-2014 at 07:17 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Vb macro coding for transpose - complete coding?
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-02-2013, 05:04 AM
  2. how to import las file through vba coding
    By srinivasgeo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2013, 03:07 AM
  3. Junk coding from TEXT import
    By penfold1992 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-30-2012, 06:24 AM
  4. Coding Access Import soecs using a Macro
    By ChromiumAgeCollector in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-06-2012, 01:19 PM
  5. Need macro / vba coding for import external data
    By Dbase Beginner in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-18-2005, 05:36 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