Closed Thread
Results 1 to 6 of 6

macro to copy cells to text files

  1. #1
    Registered User
    Join Date
    02-04-2008
    Posts
    11

    macro to copy cells to text files

    I am a beginner in Macro writing, I can only record a macro or do some basic VB commands, so I have a very basic question.
    I need a macro to copy a cell or a range of cells to text file, i.e when the macro runs, it copies your specified cells with their correct order to a normal text file

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Hi docaia,

    What are your 'specified cells' and what order would you want them written to the file?

    An example of writing cells to a file is shown below:
    Please Login or Register  to view this content.
    Last edited by Paul; 02-05-2008 at 12:19 AM.

  3. #3
    Registered User
    Join Date
    02-04-2008
    Posts
    11

    format of output file

    thanks for your reply,
    suppose I want to copy the range you specified but at column number 13 of the output text file in the example, how can this be done?

  4. #4
    Registered User
    Join Date
    02-04-2008
    Posts
    11

    Macro to paste data to specific text column

    I used your code and it works fine,
    Please Login or Register  to view this content.
    the question now is how can I paste these cells to a specified column in the text file, like copying the cells in the range A1 to A20 to column # 1 in the text file, and copying the values in the range C1 to C20 to column # 13 for example

    any help with that will be much appreciated, it will save me a lot of time

    thanks
    Last edited by VBA Noob; 02-27-2008 at 03:31 PM.

  5. #5
    Registered User
    Join Date
    02-04-2008
    Posts
    11

    send to text till last cell

    I tried the following code to copy cells to text file so that the macro searches for the cells till the last cell that has data and exports them to text file, this is the code I used:
    Please Login or Register  to view this content.
    the code works fine till a specific number of rows, I think till 10 rows, if more rows are introduced it begins exporting only the first 3 or 4 rows and ignores the rest, in a reverse way, i.e if I intoduce 11 rows, 9 rows are exported to text, if 12 rows are written then 8 rows are exported to text and so on.
    can some one tell me please what is wrong with this code?
    Last edited by docaia; 02-28-2008 at 03:25 AM. Reason: added more details

  6. #6
    Registered User
    Join Date
    02-04-2008
    Posts
    11

    Bump

    Bump this post please

Closed 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