Results 1 to 7 of 7

Code Adjustment split to csv

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Pakistan
    MS-Off Ver
    Excel 2013
    Posts
    256

    Thumbs up Code Adjustment split to csv

    Hi Watersev,

    This is your sent code to me which perfectly worked only little amendment required.

    1. Hard coded the excel master.xlsm (path in the folder) Code do not browse to search.

    2. when it creates csv in the result folder ( It creates the name of csv like sheet1,sheet2,sheet3 and so no) i need the name of worksheet tab as a .csv file name suppose worksheet tab name is test then create csv in the result folder like test.csv.

    The code is below

    
    Sub SplitToCSV()
    Dim lngcount As Integer, x As Integer, ipath As String
    With Application: .ScreenUpdating = False: .AskToUpdateLinks = False
    With .FileDialog(msoFileDialogFilePicker): .AllowMultiSelect = False
    If .Show = -1 Then
    ipath = ThisWorkbook.Path & "\" & "result": Dir (ipath)
        For lngcount = 1 To .SelectedItems.Count
          Workbooks.Open (.SelectedItems(lngcount)): ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
            For Each sh In ActiveWorkbook.Sheets
              x = x + 1: sh.Copy: ActiveWorkbook.SaveAs Filename:=ipath & "\" & x & ".csv", FileFormat:=xlCSV, CreateBackup:=False
              Workbooks(x & ".csv").Close Savechanges = True
            Next
    Next: End If: End With: .ScreenUpdating = True: End With: End Sub
    Thanks
    farrukh
    Last edited by farrukh; 08-14-2011 at 11:08 AM.

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