+ Reply to Thread
Results 1 to 6 of 6

Macro to copy column contents into a text file

  1. #1
    Registered User
    Join Date
    06-26-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    7

    Macro to copy column contents into a text file

    Hello Friends
    Please can any one help me in writing a macro, which copies the column contents in to a text file.
    the idea here is, i should give a columname as a parameter to my macro, then it should copy the contents of that columnname to a text file
    Please give me some inputs
    Thanks in Advance
    Vinay

  2. #2
    Registered User
    Join Date
    06-26-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Macro to copy column contents into a text file

    Please help me with this macro
    Thanks
    vinay

  3. #3
    Registered User
    Join Date
    06-26-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Macro to copy column contents into a text file

    Hi Friends
    Please help me with this macro
    Thanks in Advance
    Vinay

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Macro to copy column contents into a text file

    Hi vinaynagasani
    What do you have so far?
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  5. #5
    Registered User
    Join Date
    06-26-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Macro to copy column contents into a text file

    In the following macro, I am copying the Kth column entries in all sheets to a text file
    Sub WorksheetLoop()

    Dim I As Integer
    Dim J As Long

    For I = 1 To Sheets.Count
    H = 11
    Open "C:\temp\abc.txt" For Append As 1
    For J = 2 To Sheets(I).Range("K65000").End(xlUp).Row + 1
    TestVal = Sheets(I).Cells(J, H).Value
    If Len(Sheets(I).Cells(J, H).Value) = 0 Then
    GoTo label1
    End If
    Print #1, TestVal


    label1: Next J
    Close #1
    Next I

    End Sub

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Macro to copy column contents into a text file

    Hey vinaynagasan
    first a little house keeping can you add the code tags to your post
    been preoccupied but try...
    Please Login or Register  to view this content.
    we can modify to suit

+ 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