H | |
1 | 570 |
2 | 670 |
3 | 70123456 |
4 | 4570 |
Bedingte Formatierung Haupttabelle 1 | |||||||||||
Wird angewendet auf | Nr. Bed. Regeltyp | Operator | Formel1 | Formel2 | Format Schrift Füll-farbe | Unterstrichen | Schrift- farbe | Muster | Muster-farbe | Typ | Bereich |
$H:$H | 01.Bed.: Formel ist | =LINKS(H1;2)="70" | 15773696 | 2 | $H:$H |
Bedingte Formatierung Haupttabelle 2 | oberere/unterer Bereich | ||||||||
Wird angewendet auf | Nr. Bed. | Format Zelle | Anhalten | Auswahl | Anzeige | Anzahl | Durchschnitt | Typ | Bereich |
$H:$H | 01.Bed. | Falsch | 2 | $H:$H |
Option Explicit
Public Sub Markieren()
Dim vntItem As Variant
Dim strFirstAddress As String
Dim objCell As Range
With Worksheets("Tabelle1").Columns("C:D") ' Tabellennamen anpassen !!!
For Each vntItem In Array("70?", "71?") ' Ziffern anpassen !!!
Set objCell = .Find(What:=vntItem, LookIn:=xlValues, _
LookAt:=xlWhole, MatchCase:=False)
If Not objCell Is Nothing Then
strFirstAddress = objCell.Address
Do
objCell.Font.Color = vbRed
Set objCell = .FindNext(After:=objCell)
Loop Until objCell.Address = strFirstAddress
End If
Next
End With
Set objCell = Nothing
End Sub
For Each vntItem In Array("70?", "71?") ' Ziffern anpassen !!!
Private Sub CommandButton1_Click()
Dim c As Range
Dim suchBegriff As String
suchBegriff = InputBox("Rechnungsnummer eingeben") 'Text ggfls. anpassen
Set c = Worksheets("Tabelle1").Range("D:D").Find(suchBegriff, LookIn:=xlValues, LookAt:=xlWhole) _
'Suchspalte evtl. anpassen
For Each c In Worksheets("Tabelle1").UsedRange 'Blattnamen ggfls. anpassen
If Left(c.Value, 2) = suchBegriff Then
c.Interior.Color = vbRed
End If
Next c
End Sub
Private Sub CommandButton2_Click()
Range("D:D").ClearFormats 'Spalte evtl. anpassen
End Sub
Button 1 färbt dir alle Zellen rot (kann auch geändert werden), die mit der eingegebenen Zahl beginnen.Option Explicit
Private Sub CommandButton1_Click()
Dim Zelle As Range
Dim Bereich As Range
Dim suchBegriff As String
suchBegriff = InputBox("Rechnungsnummer eingeben")
If suchBegriff = "" Then Exit Sub
Set Bereich = Range("D:D")
For Each Zelle In Bereich
If InStr(1, Zelle.Value, suchBegriff) > 0 Then
With Zelle.Characters(Start:=InStr(1, Zelle.Value, suchBegriff), _
Length:=Len(suchBegriff) + 4).Font
.ColorIndex = 3 ' rot
End With
End If
Next Zelle
End Sub
Private Sub CommandButton2_Click()
Range("D:D").Font.Color = vbBlack
End Sub
Nochmal zur Erklärung: