Live-Forum - Die aktuellen Beiträge
Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Tabellen Formatierung

Forumthread: Tabellen Formatierung

Tabellen Formatierung
Romina
Hallo Zusammen,
Ich will in einer Tabelle nur die Spalten, wo in Zeile 7 SUMME steht, und die Spalte in der in Zeile 6 Summe steht formatieren.
Sub SummeFormatieren()
Dim Suchwort1 As String
Dim rngCell1 As Range, Spalte1 As Range, Dim col_1 As Integer
Suchwort1 = "Summe"
For col_1 = 1 To 100
If ActiveSheet.Cells(7, col_1) = Suchwort1 Then
Cells(7, col_1).Font.Bold = True
Cells(7, col_1).SpecialCells(xlCellTypeConstants).Interior.ColorIndex = 15
Set rngCell1 = ActiveSheet.Rows(6).Find(Suchwort1, LookAt:=xlWhole, LookIn:=xlValues, MatchCase: _
=True)
If Not rngCell2 Is Nothing Then
Set Spalte1 = rngCell1.EntireColumn
Spalte1.Font.Bold = True
Intersect(Spalte1, ActiveSheet.UsedRange).Interior.ColorIndex = 16
End If
End If
Next col_1
Set Spalte1 = Nothing
Set rngCell1 = Nothing
End Sub
Er formatiert aber alle Zellen, in denen er etwas findet.
Kann jemand helfen?
Viele Grüße
Anzeige

3
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: Tabellen Formatierung
19.06.2012 11:47:20
Romina
in Zeile 6 Steht nur einmal Summe, in Zeile 7 beliebig oft!
nicht mit xlCellTypeConstants
19.06.2012 12:34:15
Erich
Hi,
vielleicht so:

Sub SummeFormatieren2()
Dim Suchwort1 As String, rngCell1 As Range, col_1 As Long
Suchwort1 = "Summe"
For col_1 = 1 To 100
If Cells(7, col_1) = Suchwort1 Then
Cells(7, col_1).Font.Bold = True
If Not Cells(7, col_1).HasFormula Then _
Intersect(ActiveSheet.UsedRange, Cells(7, col_1). _
EntireColumn).Interior.ColorIndex = 15
End If
Next col_1
Set rngCell1 = ActiveSheet.Rows(6).Find(Suchwort1, _
LookAt:=xlWhole, LookIn:=xlValues, MatchCase:=True)
If Not rngCell1 Is Nothing Then
With rngCell1
.EntireColumn.Font.Bold = True
Intersect(.EntireColumn, ActiveSheet.UsedRange). _
Interior.ColorIndex = 16
End With
End If
Set rngCell1 = Nothing
End Sub
Rückmeldung wäre nett! - Grüße aus Kamp-Lintfort von Erich
Anzeige
AW: nicht mit xlCellTypeConstants
19.06.2012 12:40:55
Romina
Funktioniert super!Danke Dir! ;)
Viel Grüße
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Entdecke mehr
Finde genau, was du suchst

Die erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden

Suche nach den besten Antworten
Unsere beliebtesten Threads

Entdecke unsere meistgeklickten Beiträge in der Google Suche

Top 100 Threads jetzt ansehen
Anzeige