Sub Sample2()
Dim i As Long, buf As String
For i = 2 To 9
If Cells(i, 1).MergeCells Then
buf = buf & Cells(i, 1).Address(0, 0) & "-->結合されています" & vbCrLf
Else
buf = buf & Cells(i, 1).Address(0, 0) & "-->結合されていません" & vbCrLf
End If
Next i
MsgBox buf
End Sub
Sub Sample3()
Dim Target As String, i As Long, buf As String, c
Target = InputBox("年度を指定してください")
If Target = "" Then Exit Sub
For i = 2 To 9
If Left(Cells(i, 1), 4) = Target Then
buf = Target & "(" & Cells(i, 1).Address(0, 0) & ")" & vbCrLf
buf = buf & "----------" & vbCrLf
For Each c In Cells(i, 1).MergeArea
buf = buf & c.Address(0, 0) & vbCrLf
Next c
MsgBox buf
Exit For
End If
Next i
End Sub
Sub Sample5()
Dim Target As String, i As Long, buf As String, c
Target = InputBox("年度を指定してください")
If Target = "" Then Exit Sub
For i = 2 To 9
If Left(Cells(i, 1), 4) = Target Then
buf = Target & "年の受賞者は、" & vbCrLf
For Each c In Cells(i, 1).MergeArea
buf = buf & c.Offset(0, 1) & "さん" & vbCrLf
Next c
MsgBox buf
Exit For
End If
Next i
End Sub