Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1240to1244
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
Inhaltsverzeichnis

VBA - code mit Schriftfarbe erweitern

VBA - code mit Schriftfarbe erweitern
Matthias
Nabend..,
hier möchte ich bitte noch , das die Schriftfarbe mit übertragen wird, die Zellfarbe funzt soweit.
<pre>Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rc As Range
Dim lx As Long
Dim bSet As Boolean
With Tabelle4
If Intersect(Target, Range("F11:AJ40,F50:AJ79,F89:AJ118")) Is Nothing Then Exit Sub
For Each rc In Target.Cells
For lx = 5 To 32 Step 4
If rc.Value = Cells(6, lx).Value Then 'aus diesem Bereich die Zellfarbe UND die Schriftfarbe holen
rc.Interior.ColorIndex = Cells(6, lx).Interior.ColorIndex
bSet = True
End If
Next lx
If Not (bSet) Then
rc.Font.ColorIndex = xlAutomatic
Next
End With
End Sub</pre>
Gruß Matze

1
Beitrag zum Forumthread
Beitrag zu diesem Forumthread

Betreff
Benutzer
Anzeige
erledigt - !!
09.12.2011 00:59:52
Matthias
habe die "markierten ' " Zeilen nicht gehabt und nur mit
rc.Font.ColorIndex = Cells(6, lx).Font.ColorIndex probiert
so gehts nun !
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rc As Range
Dim lx As Long
Dim bSet As Boolean
With Tabelle4
If Intersect(Target, Range("F11:AJ40,F50:AJ79,F89:AJ118")) Is Nothing Then Exit Sub
For Each rc In Target.Cells
For lx = 5 To 32 Step 4
If rc.Value = Cells(6, lx).Value Then  'aus diesem Bereich die Zellfarbe UND die  _
Schriftfarbe holen
rc.Interior.ColorIndex = Cells(6, lx).Interior.ColorIndex ' funzt
rc.Font.ColorIndex = Cells(6, lx).Font.ColorIndex
rc.Font.Bold = Cells(6, lx).Font.Bold = True ' vergessen
rc.Font.Italic = Cells(6, lx).Font.Italic = True ' vergessen
bSet = True
End If
Next lx
If Not (bSet) Then rc.Interior.ColorIndex = xlNone
Next
End With
End Sub</pre>
Gruß Matze

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige