Results 1 to 7 of 7

Thread: HOW TO Save Processed Files Into Different Folders

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member littleiitin's Avatar
    Join Date
    Aug 2011
    Posts
    90
    Rep Power
    15
    Try This:

    Code:
    Sub rrr()
    
    
    
        
        'Change to the correct folder path, be sure to include the ending \
          Const strFolderPath   As String = "V:\RESG\GTS\STP-OSM\SOC\DashBoard\SandBox - confidential\Data Source - practice\darshan practice\sec alert\antivirus\March\raw data\New Folder\"
          Const strSaveFolder   As String = "P:\D2\macros\new act\"
          Dim strCurrentFile    As String
          Dim sDateFind         As String
          Dim sDateRep          As String
          Dim rLastCell         As Range
          Dim LR                As Long
          Dim wbkAct            As Workbook
          Dim strCreateFolder   As String
        strCurrentFile = Dir(strFolderPath & "*.csv")
        
        Application.ScreenUpdating = False
        
      
        Do
            Workbooks.Open (strFolderPath & strCurrentFile)
            Set wbkAct = ActiveWorkbook
            With wbkAct
            
                Columns("E:E").Select
                Selection.NumberFormat = "dd/mm/yy;@"
                Columns("L:L").Select
                Selection.NumberFormat = "dd/mm/yy;@"
                
                LR = Cells(Rows.Count, "L").End(xlUp).Row
                Range("L1:L" & LR) = Evaluate("IF(L1:L" & LR & "=0+""1/1/9999"",E1:E" & LR & _
                ",IF(LEN(L1:L" & LR & "),L1:L" & LR & ",""""))")
                
                
                Columns("J:J").Select
                Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
                Columns("I:I").Select
                Selection.TextToColumns Destination:=Range("I1"), DataType:=xlDelimited, _
                TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
                Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
                :=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
                
                
                strCreateFolder = strSaveFolder & ActiveWorkbook.Name
                MkDir strCreateFolder
                .SaveAs Filename:=strCreateFolder & "\" & ActiveWorkbook.Name
                .Close True
            
            End With
            strCurrentFile = Dir
        Loop While Len(strCurrentFile) > 0
        
        Application.ScreenUpdating = True
        
    
    MsgBox "Data formatting is completed successfully!!!!"
               
           
    End Sub

  2. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    6
    Rep Power
    0
    yes its working...but i want to save those processed files into different different folders which is already existing.
    i just need to mention the path.so that respective files will save into the given location.

    ex: After processed
    file1.csv-------->.../.../.../d1 folder
    file2.csv-------->.../.../.../d2 folder etc...

    How do i do this??
    Please help me.

Similar Threads

  1. Moving Several Files To Several Folders
    By galang_ofel in forum Excel Help
    Replies: 3
    Last Post: 06-01-2013, 04:21 PM
  2. Save Processed Files Into Different Another Folder
    By DARSHANKmandya in forum Excel Help
    Replies: 1
    Last Post: 03-22-2013, 07:10 PM
  3. Date References to save files using VBA Code
    By mrmmickle1 in forum Excel Help
    Replies: 3
    Last Post: 11-28-2012, 05:48 PM
  4. Replies: 4
    Last Post: 06-07-2012, 09:50 PM
  5. Looping through Each Files and Folders
    By Rajan_Verma in forum Rajan Verma's Corner
    Replies: 0
    Last Post: 04-18-2012, 12:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •