'こんな感じでいかが
Sub sample()
Dim inTblSh As Worksheet '入力シート
Dim otTblSh As Worksheet '出力シート
Dim wkRow As Long
Dim PutRow As Long
Dim ColCout As Long
Set inTblSh = ThisWorkbook.Sheets(1)
Set otTblSh = ThisWorkbook.Sheets(2)
wkRow = 2 'データが2行目から
otTblSh.Cells.Delete '出力先クリアー
For ColCout = 1 To 4 '出力先1行目編集
otTblSh.Cells(1, ColCout).Value = inTblSh.Cells(1, ColCout).Value
Next ColCout
Do
If inTblSh.Cells(wkRow, 1).Value = "" Then Exit Sub '終了判定
PutRow = Int(inTblSh.Cells(wkRow, 1).Value / 10) + 2 '出力行番号算出
'1列目出力
otTblSh.Cells(PutRow, 1).Value = _
Format(Int(inTblSh.Cells(wkRow, 1).Value / 10) * 10, "0~") & _
Format(Int(inTblSh.Cells(wkRow, 1).Value / 10) * 10 + 9, "0")
For ColCout = 2 To 4 'データが2列目から4列目
otTblSh.Cells(PutRow, ColCout).Value = _
otTblSh.Cells(PutRow, ColCout).Value + _
inTblSh.Cells(wkRow, ColCout).Value
Next ColCout
wkRow = wkRow + 1 '行カウントアップ
Loop
End Sub
お礼
早速実行してみました。 希望通り作成することができました。素晴らしい!ありがとうございました。