[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]
[color=darkblue]Sub[/color] CreateCSVFiles()
[color=darkblue]Dim[/color] strDestPath [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=darkblue]Dim[/color] LastRow [color=darkblue]As[/color] [color=darkblue]Long[/color]
[color=darkblue]Dim[/color] LastColumn [color=darkblue]As[/color] [color=darkblue]Long[/color]
[color=darkblue]Dim[/color] i [color=darkblue]As[/color] [color=darkblue]Long[/color]
[color=darkblue]Dim[/color] j [color=darkblue]As[/color] [color=darkblue]Long[/color]
strDestPath = ActiveWorkbook.Path
[color=darkblue]With[/color] ActiveSheet.UsedRange
LastRow = .Rows.Count + .Rows(1).Row - 1
LastColumn = .Columns.Count + .Columns(1).Column - 1
[color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]If[/color] LastRow = 1 [color=darkblue]Then[/color]
MsgBox "No data is available...", vbExclamation
[color=darkblue]Exit[/color] [color=darkblue]Sub[/color]
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]For[/color] i = 2 [color=darkblue]To[/color] LastRow
[color=darkblue]Open[/color] strDestPath & "\" & Cells(i, "A").Value & ".csv" [color=darkblue]For[/color] [color=darkblue]Output[/color] [color=darkblue]As[/color] #1
[color=darkblue]For[/color] j = 1 [color=darkblue]To[/color] LastColumn
[color=darkblue]If[/color] j <> LastColumn [color=darkblue]Then[/color]
[color=darkblue]Write[/color] #1, Cells(i, j).Text;
[color=darkblue]Else[/color]
[color=darkblue]Write[/color] #1, Cells(i, j).Text
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]Next[/color] j
[color=darkblue]Close[/color] #1
[color=darkblue]Next[/color] i
MsgBox "Completed...", vbInformation
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]