+ Reply to Thread
Results 1 to 2 of 2

Incorporating Row&Column deletes into code

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Incorporating Row&Column deletes into code

    I have a code I have been using to export a bunch of worksheets to csv files.
    I am hoping to incorporate a couple lines to delete a few rows and columns in the csv, but not in the original export file.

    Can you guys give me some lines to hopefully put in.

    Sub testexport()
    Dim i As Integer
    Dim sName As String
         
     For i = 3 To 69
         
       Sheets(i).Activate
         
       sName = ActiveSheet.Name
       
        Range("A1:W645").Copy
        Workbooks.Add
        ActiveSheet.Paste
        ActiveWorkbook.SaveAs Filename:="S:\Com\Monthly\Test\" & sName & ".csv", FileFormat:=xlCSV, CreateBackup:=False
        Application.DisplayAlerts = False
        ActiveWorkbook.Close
        Application.DisplayAlerts = True
        
    Next
         
    End Sub

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,509

    Re: Incorporating Row&Column deletes into code

    You can't really edit the csv file.

    But why not make a copy of the sheet to a temporary sheet, delete the rows on the copy, save the copy as a csv and delete the temp sheet.



    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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. Code deletes HEADER Row
    By rz6657 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2013, 01:43 PM
  2. [SOLVED] Please modify code so it deletes duplicate values in column A
    By Hello23 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-06-2012, 02:13 PM
  3. [SOLVED] Edit the code so that it loops through all worksheets and deletes column with "grand" text
    By rocksan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-13-2012, 02:58 AM
  4. Incorporating 'Zoom' code into an already existing code
    By billyster in forum Excel General
    Replies: 11
    Last Post: 03-29-2011, 04:49 PM
  5. Code that Deletes Itself
    By Caligula in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-20-2007, 11:03 PM

Tags for this Thread

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