HERBERS Excel-Forum - die Beispiele

Thema: Alle Zellen in Spalte A ohne Eintrag gelb hinterlegen

Home

Gruppe

Feature

Problem

Wie kann ich erreichen, dass alle Zellen in Spalte A, in denen kein Wert steht, gelb hinterlegt sind. Wir dein Wert eingetragen, soll die Hintergrundfarbe gelöscht werden.

Lösung
Formel für die bedingte Formatierung: =ISTLEER(A1)
StandardModule: Modul1

Sub DeleteRange()
   Dim wks As Worksheet
   Dim rng As Range
   Dim iCounter As Integer
   For iCounter = ActiveSheet.Index + 1 To Worksheets.Count
      Set wks = Worksheets(iCounter)
      Set rng = RealLastCell(wks)
      wks.Rows(rng.Row + 1 & ":" & Rows.Count).Delete
      wks.Range(wks.Cells(1, rng.Column + 1), _
         wks.Cells(1, 256)).EntireColumn.Delete
   Next iCounter
End Sub

Function RealLastCell(TheSheet As Worksheet) As Range
   Dim ExcelLastCell As Range
   Dim Row%, Col%, LastRowWithData%, LastColWithData%
   Application.ScreenUpdating = False
   Set ExcelLastCell = TheSheet.Cells.SpecialCells(xlLastCell)
   LastRowWithData = ExcelLastCell.Row
   Row = ExcelLastCell.Row
   Do While Application.CountA(TheSheet.Rows(Row)) = 0 And Row <> 1
      Row = Row - 1
   Loop
   LastRowWithData = Row
   LastColWithData = ExcelLastCell.Column
   Col = ExcelLastCell.Column
   Do While Application.CountA(TheSheet.Columns(Col)) = 0 And Col <> 1
      Col = Col - 1
   Loop
   LastColWithData = Col
   Set RealLastCell = TheSheet.Cells(Row, Col)
End Function

Beiträge aus dem Excel-Forum zu den Themen Feature und Bedingt

Bedingte Formatierung vor Copy/Paste schützen Bedingte Formatierung per VBA mit Schleife
bedingte Formatierung Bedingte Formatierung
Teilstringabfrage bei bedingter Formatierung Bedingte Formatierung mit UND Verknüpfung
Bedingte Formatierung Frage bedingte Formatierung mit mehreren Bedingungen
Bedingte Formattierung Bedingte Formatierung - kleiner als Fehler
bedingte formatierung per VBA Bedingte Formatierung bezogen auf 2. Zelle
bedingte Formatierung Bedingte Formatierung
wenn z.B. Zahl 12 dann grün (Bedingte Formatierung wenn z.B. Zahl 12 dann grün (Bedingte Formatierung
bedingte Formatierung für zellenbereich Bedingte Formatierung mit 2 Bedingungen
Bedingte Formatierung bedingte Formatierung bei 15 Kriterien
Bedingtes Nummernformat. Bedingte Formatierung
Bedingte Format. oder VBA? Bedingte Formatierung für gesamte Zeile?
Bedingte Formatierung-VBA? Bedingte Formatierung?!
bedingte formatierung per Makro Bedingte Formatierung
bedingte Formatierung sowie mit Datumsfeld Bedingte Formatierung - Zeilen gruppieren
Bedingte Formate Bedingte Formatierung mit Formel
Bedingte Codeausführung per Attribut bedingte Formatierung
Bedingte Formatierung anhalten Bedingte Formatierung - Dringend
Bedingte Formatierung Nach bestimmter bedingter Formatierung suchen
Bedingte Formatierung Automatisch schliessen ohne Speichern, bedingt
Bedingte Formateierung Bedingte Formatierungen - Datenbalken
Kompatibilität -Bedingte Formatierung NUR bedingte Formate übertragen
mehr als 3 bedingte formatierungen Bedingte Formatierung - gantt Diagramm
Bedingte Formatierung in Pivot_NICHT in SubTotals? Dreifach Bedingte Formatierung über VBA in Pivot
bedingte Formatierung und Formeln