Live-Forum - Die aktuellen Beiträge
Datum
Titel
24.04.2024 19:29:30
24.04.2024 18:49:56
Anzeige
Archiv - Navigation
700to704
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
700to704
700to704
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

bed. Format - auch leere Zellen ???

bed. Format - auch leere Zellen ?
01.12.2005 14:51:11
Lupo
Hallo Forum,
benötige Hilfe: Habe script, aber weiß nicht, wie auch die leeren Zellen unterpunktet werden, wenn in Spalte F etwas steht. Wie ist das anzupassen?
Wer hilft mir bitte?
soll auch rein - aber auch leere Zellen underlined, wenn in F etwas steht:
Selection.FormatConditions(1).Borders(xlLeft).LineStyle = xlNone
Selection.FormatConditions(1).Borders(xlRight).LineStyle = xlNone
Selection.FormatConditions(1).Borders(xlTop).LineStyle = xlNone
With Selection.FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
vorhanden - hier sollte es mit rein:

Sub bedingt_Format1()
Application.Goto Reference:="Format1"
'Austausch X zu R
'    ActiveWorkbook.Save
'    Selection.Replace What:="X", Replacement:="R", LookAt:=xlPart, _
'        SearchOrder:=xlByRows, MatchCase:=False
' bedingtes Format Rot, Blau, Schwarz
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=UND($F5=""2x/Woche"";ODER(O5=""R"";O5=""X""))"
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=UND($F5=""1x/Woche"";ODER(O5=""R"";O5=""X""))"
With Selection.FormatConditions(2).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
Selection.FormatConditions(2).Interior.ColorIndex = 5
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=UND($F5=""1x/Monat"";ODER(O5=""R"";O5=""X""))"
With Selection.FormatConditions(3).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
Selection.FormatConditions(3).Interior.ColorIndex = 1
Range("d5").Select
End Sub

Hilfe wäre prima! Danke!
Lupo

7
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: bed. Format - auch leere Zellen ?
02.12.2005 08:56:28
Harald
Hallo Lupo,
...weiß nicht, wie auch die leeren Zellen unterpunktet werden, wenn in Spalte F etwas steht. Wie ist das anzupassen?
Welche leeren Zellen ?
Der Einzige hier, der deine datei vor sich sieht, bist Du selbst ;-)))
Mein Tipp: Spiel den Vorgang durch, bis er komplett so sit, wie er sein soll und dann zeichne alles per Rekorder auf.
Diese Aufgabenstellung überfordert den Rekorder nicht ;-))
Gruss Harald
AW: bed. Format - auch leere Zellen ?
02.12.2005 10:28:53
Lupo
Hallo Harald,
gemeint ist, dass in der jeweiligen Zeile nicht alle Felder gefüllt sind, also auch leere Zellen vorkommen. Es soll aber die ganze Zeile mit Unterpunkten versehen werden, wenn in F etwas steht. Der Rekorder bringt mich da nicht weiter.
Gruß
Lupo
Anzeige
AW: bed. Format - auch leere Zellen ?
02.12.2005 10:58:34
Harald
Na denn, vielleicht hilft das besser.

Sub Makro1()
Dim i As Long
For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row 'letzte Zeile in Spalte A
If Cells(i, 6) <> "" Then  'wenn in Spalte F ungleich leer
With Rows(i).Borders(xlEdgeBottom)  'ganze Zeile gepunkteter Unterstrich
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
Else
Rows(i).Borders(xlEdgeBottom).LineStyle = xlNone
End If
Next i
End Sub

Gruss Harald
AW: bed. Format - auch leere Zellen ?
02.12.2005 12:18:15
Lupo
Hallo Harald,
versuchte es einzubinden - muss was verkehrt haben. Kannst du bitte einmal schauen. Der Bereich (Format1) ist P:BY.

Sub Format1()
Application.Goto Reference:="Format1"
Dim i As Long
For i = 1 To Cells(Rows.Count, 6).End(xlUp).Row 'letzte Zeile in Spalte F
If Cells(i, 6) Formula1:=   "=UND($F5=""2x/Woche"";ODER(P5=""R"";P5=""X""))"" Then  'wenn in Spalte F und P diese Begriffe
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
With Rows(i).Borders(xlEdgeBottom)  'ganze Zeile gepunkteter Unterstrich
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
If Cells(i, 6) Formula1:=    "=UND($F5=""1x/Woche"";ODER(P5=""R"";P5=""X""))" Then  'wenn in Spalte F und P diese Begriffe
With Selection.FormatConditions(2).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
Selection.FormatConditions(2).Interior.ColorIndex = 5
With Rows(i).Borders(xlEdgeBottom)  'ganze Zeile gepunkteter Unterstrich
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
If Cells(i, 6) Formula1:=    "=UND($F5=""1x/Monat"";ODER(P5=""R"";P5=""X""))" Then  'wenn in Spalte F und P diese Begriffe
With Selection.FormatConditions(3).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
Selection.FormatConditions(3).Interior.ColorIndex = 1
With Rows(i).Borders(xlEdgeBottom)  'ganze Zeile gepunkteter Unterstrich
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
Else
Rows(i).Borders(xlEdgeBottom).LineStyle = xlNone
End If
Next i
End Sub

Danke und Gruß
Lupo
Anzeige
AW: bed. Format - auch leere Zellen ?
02.12.2005 12:38:39
Harald
3mal If und nur einmal End If, kann nicht gehen ;-))
hab zweimal aus If ein ElseIf gemacht

Sub Format1()
Application.Goto Reference:="Format1"
Dim i As Long
For i = 1 To Cells(Rows.Count, 6).End(xlUp).Row 'letzte Zeile in Spalte F
If Cells(i, 6) Formula1:=   "=UND($F5=""2x/Woche"";ODER(P5=""R"";P5=""X""))"" Then  'wenn in Spalte F und P diese Begriffe
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
With Rows(i).Borders(xlEdgeBottom)  'ganze Zeile gepunkteter Unterstrich
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
elseIf Cells(i, 6) Formula1:=    "=UND($F5=""1x/Woche"";ODER(P5=""R"";P5=""X""))" Then  'wenn in Spalte F und P diese Begriffe
With Selection.FormatConditions(2).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
Selection.FormatConditions(2).Interior.ColorIndex = 5
With Rows(i).Borders(xlEdgeBottom)  'ganze Zeile gepunkteter Unterstrich
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
elseIf Cells(i, 6) Formula1:=    "=UND($F5=""1x/Monat"";ODER(P5=""R"";P5=""X""))" Then  'wenn in Spalte F und P diese Begriffe
With Selection.FormatConditions(3).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
Selection.FormatConditions(3).Interior.ColorIndex = 1
With Rows(i).Borders(xlEdgeBottom)  'ganze Zeile gepunkteter Unterstrich
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
Else
Rows(i).Borders(xlEdgeBottom).LineStyle = xlNone
End If
Next i
End Sub

Gruss Harald
Anzeige
AW: bed. Format - auch leere Zellen ?
02.12.2005 13:52:46
Lupo
Danke Harald,
bin halt Anfänger. Schönes Wochenende!
Gruß
Lupo
Danke für die Rückmeldung owT
02.12.2005 14:08:47
Harald
Gruss Harald

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige