| 
    
     |  | ▼しげ さん: >確認しないと問題が発生するわけではありません。
 では、確認なんてやめましょう。無駄ですし。
 
 期間以前の月は無視し、期間内・期間以降の月に
 年を追加するようにしてあります。
 
 Sub Macro1()
 Dim MonthStart As Date, MonthEnd As Date
 Dim CellStart As Range, CellEnd As Range
 
 With Worksheets("シート1")
 MonthStart = DateValue(.Range("A1").Text & "1日")
 MonthEnd = DateValue(.Range("C1").Text & "1日")
 End With
 
 
 With Worksheets("シート2")
 Set CellStart = .Rows(1).Find(What:=Format(MonthStart, "m月"), _
 After:=.Range("A1"), LookAt:=xlWhole)
 If CellStart Is Nothing Then
 Set CellStart = .Range("A1")
 End If
 
 Set CellEnd = .Cells(1, Columns.Count).End(xlToLeft)
 
 With .Range(CellStart, CellEnd)
 .Cells(1).Value = Format(MonthStart, "yyyy年") & CellStart.Text
 .Cells(1).AutoFill Destination:=.Cells
 .EntireColumn.AutoFit
 End With
 End With
 
 Set CellStart = Nothing
 Set CellEnd = Nothing
 
 MsgBox "完了しました。", vbInformation
 End Sub
 
 
 |  |