AW: Erste Freie Zeile finden und automatisches Datum
14.08.2014 12:34:06
Klaus
Hallo Marc,
im Prinzip so. Ich suche die letzte Zeile allerdings in Spalte N, nirgendwo anders. Kannst den Teil "lRow = " gerne gegen deinen gefundenen Code austauschen.
Sub Einfuegen()
Dim lRow As Long
Const dateCol As Long = 14 'Datums stehen in Spalte N = 14
Const fCol As Long = 1 'Ab Spalte A = 1
Const lCol As Long = 23 'bis spalte W = 23
Application.ScreenUpdating = False
With Sheets("Tabelle1") 'ändern
'letzte Zeile feststellen
lRow = .Cells(.Rows.Count, dateCol).End(xlUp).Row + 1
'Datum einfügen
With .Cells(lRow, dateCol)
.Value = Date
'Falls nötig: Die Datum-Formatierung erzwingen
.NumberFormat = "[$-407]d/ mmm/ yyyy;@"
End With
'Rahmen setzen
With .Range(.Cells(lRow, fCol), .Cells(lRow, lCol))
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlInsideVertical).LineStyle = xlContinuous
End With
End With
Application.ScreenUpdating = True
End Sub
Grüße,
Klaus M.vdT.