Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
696to700
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
696to700
696to700
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Variable bedingte Formatierung in VBA

Variable bedingte Formatierung in VBA
15.11.2005 17:37:45
Tino
Hallo,
stehe grad voll aufm Schlauch.
Folgendes Problem:
ich brauche auf einem Tabellenblatt von jeder zweiten Zelle eine bedingte Formatierung für die rechte und untere Nachbarzelle.
hier schon mein Code-Snippet:

Sub bed_form()
For y = 16 To 114 Step 2
For x = 9 To 107 Step 2
Cells(y, x).FormatConditions.Delete
Cells(y, x).FormatConditions.Add Type:=xlExpression, Formula1:=" xxx "
Cells(y, x).FormatConditions(1).Interior.ColorIndex = 3
Cells(y + 1, x).ClearContents
Cells(y, x + 1).ClearContents
Next x
Next y
End Sub

Für xxx sollte folgende Formel eingetragen werden: =RUNDEN( [untere Zelle] ;0)RUNDEN( [rechte Zelle] ;0)
Wie löse ich das in VBA?
Danke.

4
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Variable bedingte Formatierung in VBA
15.11.2005 17:42:11
Born
vielleicht gehts mit:
=round(cells(activecell.row+1,activecell.column);0) ...
AW: Variable bedingte Formatierung in VBA
15.11.2005 17:53:56
Tino
... ich denke mal nicht, da die Formel als String eingegeben werden muss.
dachte da an sowas wie "=RUNDEN(" & ... & ";0) RUNDEN(" & ... & ";0)"
und für ... brauch ich irgend etwas was mir Ergebnisse wie I17 und J16 (z.B.) liefert.
AW: Variable bedingte Formatierung in VBA
15.11.2005 18:02:30
Born
Hi,
mit cells(activecell.row+1,activecell.column) greifst Du auf die untere Zelle zu und mit cells(activecell.row,activecell.column+1) auf die rechte.
Der String müßte dann etwa so lauten: ="=round(cells(activecell.row+1,activecell.column),0)round(cells(activecell.row,activecell.column+1),0)"
Gruß
M.Born
Anzeige
AW: Variable bedingte Formatierung in VBA
15.11.2005 18:18:39
Tino
Hi ...
danke für die Antwort.
Hat zwar nicht so geklappt, hast mich aber auf den richtigen Weg gebracht, wie gesagt, stand auf dem Schlauch.
Cells(x,y).ADDRESS gibt mir den String als z.B. $A$1 zurück
also so:
... Formula1:="=RUNDEN(" & Cells(y+1,x).Address & ";0) RUNDEN(" & Cells(y,x+1).Address & ";0)"

331 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige