Option VBASupport 1
REM ***** BASIC *****
Sub Main
Dim xlLastRow As Long 'Excel自体の最終行
Dim LastRow As Long '最終行
Dim i As Integer
Dim j As Integer
Dim s As String
Dim RowAfterAdd As Long
Dim Cellnum() As Long
xlLastRow = Cells(Rows.Count, 2).Row 'Excelの最終行を取得
LastRow = Cells(xlLastRow, 2).End(xlUp).Row 'B列の最終行を取得
ReDim Cellnum(LastRow)
'配列数記憶
For i = 3 To LastRow
j = 3
s = 0
Do While Cells(i, j).Value <> ""
s = s + 1
j = j + 1
Loop
Cellnum(i) = s
Next i
'For i = 3 To LastRow
' RowAfterAdd = RowAfterAdd + Cellnum(i) - 1
'Next i
'LastRow = LastRow + RowAfterAdd
'行の挿入と初期値の展開
RowAfterAdd = 0
For i = 3 To LastRow
For j = 2 To Cellnum(i)
Rows( i+1+RowAfterAdd ).Insert
Call Cells(i, j+2).Cut(Range(Cells(i+1+RowAfterAdd,j+1)))
Next j
RowAfterAdd = RowAfterAdd + Cellnum(i) - 1
Next i
End Sub
Sub sample
Range(Cells(1,1)).Select
End Sub