|
- Public Sub arrange1()
- Dim a As Range, b As Range, x As Range
- Application.DisplayAlerts = False
- [e5:ai5].UnMerge
- [e5:ai5].NumberFormatLocal = "yyyy年m月"
- [e6:ai6].NumberFormatLocal = "d"
- [e6] = [P3]
- [e6:ai6].DataSeries Date:=xlDay, Step:=([V3] - [P3]) / 30
- For Each x In [e6:ai6]
- If x.Column = 5 Then Set a = x: GoTo 100
- If x.Column = 35 Then
- Set b = x
- Range(a, b).Offset(-1).Merge
- Range(a, b).Offset(-1)(1) = Format(a, "yyyy年m月")
- Exit Sub
- End If
- If Day(x) < Day(x.Offset(0, -1)) Then
- Set b = x.Offset(0, -1)
- Range(a, b).Offset(-1).Merge
- Range(a, b).Offset(-1)(1) = Format(a, "yyyy年m月")
- Set a = x
- End If
- 100:
- Next
- [e5:ai5].Borders.LineStyle = xlContinuous
- Application.DisplayAlerts = True
- End Sub
复制代码
|
|