シート1番目の内容をCSVファイルで出力する方法
Sub writeCSV() Dim ws As Worksheet Set ws = ThisWorkbook.Worksheets(1) Dim csvFile As String csvFile = ActiveWorkbook.Path & "\data.csv" Open csvFile For Output As #1 Dim i As Long, j As Long i = 1 Do While ws.Cells(i, 1).Value <> "" j = 1 Do While ws.Cells(i, j + 1).Value <> "" Print #1, ws.Cells(i, j).Value & ","; j = j + 1 Loop Print #1, ws.Cells(i, j).Value & vbCr; i = i + 1 Loop Close #1 MsgBox "data.csvに書き出しました" End Sub