+ Reply to Thread
Results 1 to 10 of 10

Copy Data Columns From CSV paste into Next available blank space

  1. #1
    Registered User
    Join Date
    04-03-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    39

    Copy Data Columns From CSV paste into Next available blank space

    Hi

    I have some data from many csv files.

    I would like to record/create a macros to open the file and paste 4 columns worth of data into another spreadsheet. Making sure the data is pasted in the correct column and doesn't overight data already in a tracker. Ie. paste it into the next available space.

    Help is always appreciate.
    Thank you

    Output.csv
    Last edited by Matt1998; 07-10-2014 at 05:29 AM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Copy Data Columns From CSV paste into Next available blank space

    attached file has 8 colummns, you want 4, can you attach desired output ?
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    04-03-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Copy Data Columns From CSV paste into Next available blank space

    Sorry yes.

    So the input tab is what comes out as a csv and the Ouput tab is what I would like.

    However when I have my output master file open I need to be able to run the macro from the input file and paste the columns in the next available cell row within into the output file.

    AttachedInput v Output.csv

    Thank you
    Matt

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Copy Data Columns From CSV paste into Next available blank space

    I don't understand, you are asking for a macro, then you attach a csv file as output, csv file does not support macros.

  5. #5
    Registered User
    Join Date
    04-03-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Copy Data Columns From CSV paste into Next available blank space

    I don't really know what I want. Whichever is the best way to do the task then that would be the way I would do it.

  6. #6
    Registered User
    Join Date
    04-03-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Copy Data Columns From CSV paste into Next available blank space

    The files are saved as an Excel CSV file not a normal csv file. If this helps.

    So:
    The Input Tab is an example in a csv excel file of what I get.
    I'm wanting to get 4 columns from these files and post them into the next available space in another spreadsheet (The output sheet)

    Hope that clears things up

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Copy Data Columns From CSV paste into Next available blank space

    Hi, Matt,

    there are two ways of approaching: import the CSV via TextToColumns-Wizard and sort/delete the columns to your needs or work on the lines when importing hte text file.

    Code will ask for a new of a text file to import. At the moment a new workshett is added, if you like to work on the same sheet the line to clear is commented out at the meoment. Textfile will be imported into workbook which holds the code:
    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  8. #8
    Registered User
    Join Date
    04-03-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Copy Data Columns From CSV paste into Next available blank space

    Hi Holger. Thanks for this. I'm almost there.

    Due to the volume of these files (Daily) - is there anyway that when the macro runs it pastes the data in the next available row, rather than overwriting the data that is already been previously run by the macro.

    So say I run the macro it grabs 4 columns and the data goes down to Row 10. The next time I run the macro it grabs 4 columns and pastes the data in row 11 -21 etc ?

    Also it does create an extra sheet which is fine I can delete this but I don't need the sheet to be there once the data has been grabbed and pasted.

    Further help is massively appreciated.

    Thank you all
    Matt

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Copy Data Columns From CSV paste into Next available blank space

    Hi, Matt,

    you would need to adapt the constant to your needs or live with a new sheet added under the name of the constant and being updated. As there was a header row in the file this will be skipped for each further import:
    Please Login or Register  to view this content.
    Ciao,
    Holger

  10. #10
    Registered User
    Join Date
    04-03-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Copy Data Columns From CSV paste into Next available blank space

    I think I can live with this.

    Massive Thanks
    Matt

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy and Paste only blank columns?
    By Drigomaniac in forum Excel General
    Replies: 2
    Last Post: 10-21-2013, 03:38 PM
  2. [SOLVED] Copy multiple worksheets data & paste into blank columns in summary worksheet
    By guest99999 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-21-2013, 09:56 AM
  3. Replies: 2
    Last Post: 02-22-2011, 02:07 AM
  4. Copy value after second blank space
    By Rodrigo Rocha in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-25-2010, 03:05 PM
  5. Excel 2007 : Copy data ok but paste blank!
    By gozo in forum Excel General
    Replies: 1
    Last Post: 07-24-2009, 08:35 PM

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