Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

ColorIndex-Problem

Forumthread: ColorIndex-Problem

ColorIndex-Problem
09.09.2003 09:12:18
panther
Hey,
ich habe ein Problem, welches ich zur Vereinfachung mal in u.g. Code dargestellt habe.
Ablauf:
Frage Hintergrundfarbe der Zelle A1 ab,
wenn rot, dann färbe die nächste Zelle auch rot
wenn hellrot, dann färbe die nächste Zelle auch hellrot
sonst färbe die nächste Zelle pink.

Zur Vereinfachung gebe ich in der ersten Zeile vor, dass Zelle A1 rot sein soll.
=> Läuft einwandfrei
Problem:
Gebe ich in der ersten Zeile als ColorIndex 22 (hellrot) ein, dann folgt die Fehlermeldung "Laufzeitfehler"?!?!

Warum, ist doch das exakt das gleiche???


Sub Farbtest()
Dim c As Integer
Cells(1, 1).Interior.ColorIndex = 22
MsgBox "zelle gefaerbt"
If Cells(1, 1).Interior.ColorIndex = 3 Then
Cells(1, 2).Interior.ColorIndex = 3
MsgBox "2.Zelle rot"
ElseIf Cells(1, 1).Interior.ColordIndex = 22 Then
Cells(1, 2).Interior.ColorIndex = 22
MsgBox "2. Zelle hellrot"
Else
Cells(1, 2).Interior.ColorIndex = 26
MsgBox "2. Zelle pink"
End If
End Sub

Anzeige

1
Beitrag zum Forumthread
Beitrag zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
Schreibfehler: "ColordIndex" o.T
09.09.2003 09:24:33
Christoph
Anzeige
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige