|
▼びめびめ さん:
一例です。
Sub Sample()
Dim i As Long
Dim n As Long
Dim cnt As Long
Dim x As Long
Dim p As Long
Dim myPath As String
Application.ScreenUpdating = False
myPath = ThisWorkbook.Path '<==保存フォルダ 適宜変更
With Sheets("Sheet1") '<== 適宜変更
x = .Cells.SpecialCells(xlCellTypeLastCell).Column
i = .Range("A" & .Rows.Count).End(xlUp).Row
n = (i - 5) \ 100
If (i - 5) Mod 100 <> 0 Then n = n + 1
For i = 1 To n
cnt = cnt + 1
Workbooks.Add
Range("A1").Resize(5, x).Value = .Range("A1").Resize(5, x).Value
p = 5 + (i - 1) * 100 + 1
Cells(6, "A").Resize(100, x).Value = .Cells(p, "A").Resize(100, x).Value
ActiveWorkbook.SaveAs myPath & "\datas_" & Format(cnt, "000")
ActiveWorkbook.Close
Next
End With
Application.ScreenUpdating = True
MsgBox "保存が完了しました"
End Sub
|
|