AW: Zellen verbinden über Berechnung
15.04.2014 11:13:33
Tino
Hallo,
hättest ja ruig mal schreiben könne das ich dich nicht verstanden habe!
Sub Verbinden()
Dim nCol1, nCol2
Dim MinDate As Date, MaxDate As Date, Monate&, n&
Application.EnableEvents = False
With Tabelle1
.Range("I6", .Cells(6, .Columns.Count)).UnMerge
.Range("I6", .Cells(6, .Columns.Count)).ClearFormats
MinDate = Application.WorksheetFunction.Min(.Rows(10))
MaxDate = Application.WorksheetFunction.Max(.Rows(10))
Monate = DateDiff("m", MinDate, MaxDate)
For n = 1 To Monate
nCol1 = Application.Match(CLng(MinDate), .Rows(10), 0)
MaxDate = DateSerial(Year(MinDate), Month(MinDate) + 1, 0)
nCol2 = Application.Match(CLng(MaxDate), .Rows(10), 0)
If IsNumeric(nCol1) Then
If IsNumeric(nCol2) Then
With .Range(.Cells(6, nCol1), .Cells(6, nCol2))
.Merge
.Cells(1, 1) = Format(MinDate, "mmmm")
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Interior.Color = RGB(255, 192, 0)
.Font.Size = 16
.Font.Bold = True
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
End With
End If
End If
MinDate = DateSerial(Year(MinDate), Month(MinDate) + 1, 1)
Next n
End With
Application.EnableEvents = True
End Sub
Gruß Tino