|
どこが難しいのでしょーか ?
Sub シート振り分け2()
Dim MyF As String, Buf As String, Sn As String
Dim Ary As Variant
Dim i As Long
With Application
MyF = .GetOpenFilename("CSVファイル(*.csv),*.csv")
If MyF = "False" Then Exit Sub
.ScreenUpdating = False
End If
Sheets("Sheet1").Cells.ClearContents
For i = 1500 To 4000 Step 500
Worksheets(CStr(i)).Cells.ClearContents
Next i
Open MyF For Input Access Read As #1
Do Until EOF(1)
Line Input #1, Buf
Ary = Split(Buf, ",")
Sheets("Sheet1").Range("A65536").End(xlUp).Offset(1) _
.Resize(, UBound(Ary) + 1).Value = Ary
Select Case Ary(2)
Case 1000, 1500, 2000, 2500, 3000, 3500, 4000
Sn = CStr(Ary(2))
Sheets(Sn).Range("A65536").End(xlUp).Offset(1) _
.Resize(, UBound(Ary) + 1).Value = Ary
End Select
Erase Ary
Loop
Close #1
Application.ScreenUpDating = True
End Sub
|
|