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

Makro kürzen?

Forumthread: Makro kürzen?

Makro kürzen?
29.12.2004 17:39:24
Thomas
Hallo Excelfreunde,
kann man dieses Makro kürzen?

Sub Zellen_Färben()
Dim c As Range
Application.ScreenUpdating = False
For Each c In Range("B3:K42")
If c. = "0 0" Then
c.Interior.ColorIndex = 3
End If
Next c
For Each c In Range("B3:K42")
If c. = "1 0" Then
c.Interior.ColorIndex = 3
End If
Next c
For Each c In Range("B3:K42")
If c. = "2 0" Then
c.Interior.ColorIndex = 3
End If
Next c
For Each c In Range("B3:K42")
If c. = "3 0" Then
c.Interior.ColorIndex = 3
End If
Next c
For Each c In Range("B3:K42")
If c. = "4 0" Then
c.Interior.ColorIndex = 3
End If
Next c
For Each c In Range("B3:K42")
If c. = "5 0" Then
c.Interior.ColorIndex = 3
End If
Next c
For Each c In Range("B3:K42")
If c. = 6 0" Then
c.Interior.ColorIndex = 3
End If
Next c
For Each c In Range("B3:K42")
If c. = "7 0" Then
c.Interior.ColorIndex = 3
End If
Next c
For Each c In Range("B3:K42")
If c. = "8 0" Then
c.Interior.ColorIndex = 3
End If
Next c
For Each c In Range("B3:K42")
If c. = "9 0" Then
c.Interior.ColorIndex = 3
End If
Next c
Application.ScreenUpdating = True
End Sub

MfG Thomas.
Anzeige

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Makro kürzen?
Kay
Hallo Thomas,
das wäre eine Möglichkeit:

Sub Zellen_Färben()
Dim c As Range
Application.ScreenUpdating = False
For Each c In Range("B3:K42")
Select Case c
Case Is = "0 0", "1 0"     ' usw.
c.Interior.ColorIndex = 3
End Select
Next c
Application.ScreenUpdating = True
End Sub

Gruß Kay
Anzeige
AW: Makro kürzen?
29.12.2004 18:02:00
Josef
Hallo Thomas
zB. so:

Sub Zellen_Färben()
Dim c As Range
Application.ScreenUpdating = False
For Each c In Range("B3:K42")
Select Case c
Case "0 0", "1 0", "2 0", "3 0", "4 0", "5 0", "6 0", "7 0", "8 0", "9 0"
c.Interior.ColorIndex = 3
Case Else
End Select
Next c
Application.ScreenUpdating = True
End Sub

Gruß Sepp
Anzeige
Oups! zu langsam;-)) o.T.
29.12.2004 18:02:55
Josef
Gruß Sepp
AW: Makro kürzen?
Beni
Hallo Thomas,
Gruss Beni

Sub Zellen_Färben()
Dim c As Range
Application.ScreenUpdating = False
For Each c In Range("B3:K42")
If c = "0 0" Or c = "1 0" Or c = "2 0" Or c = "3 0" Or c = "4 0" _
Or c = "5 0" Or c = "6 0" Or c = "7 0" Or c = "8 0" Or c = "9 0" Then
c.Interior.ColorIndex = 3
End If
Next c
Application.ScreenUpdating = True
End Sub

Anzeige
AW: Makro kürzen?
29.12.2004 18:15:12
Thomas
Vielen Dank für Eure Hilfe.
Kay und Josef's Makrokürzung habe ich schon getestet, es funtioniert.
Beni Dein Makro teste ich später.
MfG Thomas.
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige