Hello,

another question from

I have csv files.

i want to do minor modification and save as csv with new name by adding number at end of file name and not to overwrite the old one.

example:
old file: test1234.csv new file: test1234-1.csv

below are the code that need to tweak

Option Explicit
 
Sub saveascsv ()
     
    Dim xRow As Long
    Dim xFname$, InitialFoldr$, xDirect$
    Dim lr As Long
    
    'xFname$ = Dir(InitialFoldr$, 7)
    
    InitialFoldr$ = "C:\" '<<< Startup folder to begin searching from
     
    With Application.FileDialog(msoFileDialogFolderPicker)
        .InitialFileName = Application.DefaultFilePath & "\"
        .Title = "Please select a folder to list Files from"
        .InitialFileName = InitialFoldr$
        .Show
        If .SelectedItems.Count <> 0 Then
            xDirect$ = .SelectedItems(1) & "\"
            xFname$ = Dir(xDirect$, 7)
        End If
    End With
    
    
    Columns("N:N").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    

    Application.DisplayAlerts = False
    ActiveWorkbook.Save
    ActiveWorkbook.Close
    Application.DisplayAlerts = True
    End If
    xFname$ = Dir
    Loop
MsgBox "Done!!"
End Sub
Appreciate for any helps.

Thank you.