Hier der Source-Code des Problems
Mandix
Ok, hier die Problem-Prozedur:
Private Sub bNewLine_Click()
Dim row, copyRow, pasteRow
row = ActiveCell.row
'if we are in the first line of data...
If row = Range("no").row + 2 Then
'...create the row one row deeper and copy the contents of the upper row (reason: formatting)
Selection.Copy
Cells(row + 1, Range("no").Column).Select
ActiveCell.EntireRow.Insert
Selection.PasteSpecial
Cells(row, Range("no").Column).Select
copyRow = ActiveCell.row + 1
Else
ActiveCell.EntireRow.Insert
copyRow = ActiveCell.row - 1
End If
pasteRow = ActiveCell.row
ActiveCell.EntireRow.Select
Selection.ClearContents
Application.CutCopyMode = False
'copy the format for the whole line
Cells(copyRow, 1).EntireRow.Select
Selection.Copy
Cells(pasteRow, 1).EntireRow.PasteSpecial xlPasteFormats
Application.CutCopyMode = False
'copy the formulas of the fields with formulas
Dim cell1
cell1 = Range("duration1").Column
For c = 0 To 6
Range(Cells(copyRow, cell1 + 4 * c), Cells(copyRow, cell1 + 4 * c + 1)).Select
Selection.Copy
Range(Cells(pasteRow, cell1 + 4 * c), Cells(pasteRow, cell1 + 4 * c + 1)).PasteSpecial xlPasteFormulasAndNumberFormats
Application.CutCopyMode = False
Next c
'do the last duration (duration8) explicit, because there is no more break here
Cells(copyRow, Range("duration8").Column).Select
Selection.Copy
Cells(pasteRow, Range("duration8").Column).PasteSpecial xlPasteFormulasAndNumberFormats
Application.CutCopyMode = False
ActiveCell.EntireRow.Select
'important initialization for later calculation of dependencies
Dim initStartCol
initStartCol = Range("start1").Column
For i = 0 To 7
Cells(ActiveCell.row, initStartCol + i * 4) = 0 'start time
Cells(ActiveCell.row, initStartCol + i * 4 + 1) = 0 'end time
Next i
'end of important initialization
Call resetFields
Call updateIndices
End Sub