+ Reply to Thread
Results 1 to 2 of 2

Opening all .csv files in a folder and deleting specific columns

  1. #1
    Registered User
    Join Date
    09-03-2012
    Location
    Afsa
    MS-Off Ver
    Excel 2003
    Posts
    1

    Opening all .csv files in a folder and deleting specific columns

    Hi,

    I have got a number of CSV files in a folder and want to open each csv, delete a number of columns, then save and close the csv.

    Not sure where to start on this! Pretty new to VBA!

    Any help is hugely appreciated!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Opening all .csv files in a folder and deleting specific columns

    Hi,

    The simplest place to start is to record a macro, then edit it as necessary to remove a lot of superfluous stuff.

    As far as I remember you can opt to choose to remove columns during the csv upload definition, but if you prefer you could just upload the whole file and then delete the columns afterwards. e.g. Range("B:B,E:E").Columns.Delete.

    Then save the file as a .csv file, or perhaps you want to copy the data and paste into your destination workbook.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ 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