AW: Zellen löschen
31.08.2018 13:22:16
niclaus
Hallo Brigitte
Ich hätte da was:
Sub testAA()
Dim zelle As Range
Dim bereich As Range
Dim sp, clast
clast = Range("A1").SpecialCells(xlCellTypeLastCell).Row
Set bereich = Range("AD6:AF6")
For Each zelle In bereich
If zelle.Value = "" Then
sp = zelle.Column
Exit For
End If
Next
If sp = "" Then Exit Sub
Range(Cells(7, sp), Cells(clast, 32)).ClearContents
End Sub
Was ich ändern würde in Deinen Tabellen:
In AD6 (und analog dazu in AE6:AF6) schreibst Du
=WENN(TAG(AC6+1)=1;"";AC6+1)
Nimm mal ein Datum mit 1. Februar 2018. Das führt zu "unschönen" Ergebnissen in AE5:AF6.
Ich würde die Formeln ändern.
In AD6: =WENN(MONAT(AC6+1)MONAT(AC6);"";AC6+1)
In AE6: =WENN(MONAT(AC6+2)MONAT(AC6);"";AC6+2)
In AF6: =WENN(MONAT(AC6+3)MONAT(AC6);"";AC6+3)
Und als Tüpfelchen auf dem i: Mit Bedingter Formatierung in AD5:AF6 die Farben "ausschalten".
Ich hoffe, das hilft Dir. Grüsse Niclaus