Sub CheckCellE()
Dim endRow As Long
Dim i As Integer
endRow = Cells(Rows.Count, 1).End(xlUp).Row 'Find the end of the row
For i = 1 To endRow
' E列に「-」がある行を選択する
If Cells(i, 5).Value = "-" Then
'その行の一行上に移動する , 移動した行のAからC列をコピーペーストする
Range(Cells(i - 1, 1), Cells(i - 1, 3)).Copy Destination:=Cells(i, 1)
End If
Next i
dim sI as long
dim sJ as long
dim sP as long
dim tbl(11,6) as variant
'テーブルに11R分の無しデータを準備
for sI=1 to 11
tbl(sI,1)=cells(2,1):tbl(sI,2)=cells(2,2):tbl(sI,3)=cells(2,3)
tbl(sI,4)=trim(str(sI)) & "R"
tbl(sI,5)="-":tbl(sI,6)="-"
next
'nRが存在するものをテーブルにセット
sP=Cells(65536,1).End(xlUp).Row
for sI=1 to 11
for sJ=2 to sP
if tbl(sI,4)=cells(sJ,4) then tbl(sI,5)=cells(sJ,5):tbl(sI,6)=cells(sJ,6)
next
next
'セルに書き出す
for sI=1 to 11
for sJ=1 to 6
cells(sI+1,sJ)=tbl(sI,sJ)
next
next
'書式を整える
Range("A2:F12").Select
Selection.NumberFormatLocal = "m""月""d""日"""
With Selection.Font
.Name = "MS Pゴシック"
.Size = 10
.ColorIndex = xlAutomatic
End With