13.01.2018, 16:07
(Dieser Beitrag wurde zuletzt bearbeitet: 13.01.2018, 18:04 von WillWissen.
Bearbeitungsgrund: Makro in Codetags gesetzt
)
Hallo zusammen,
ich habe u.g. Makro erstellt. Dieses funzt auch, allerdings dauert das alles sehr sehr lange > 2min
Kann ich das Makro optimieren ??
ich habe u.g. Makro erstellt. Dieses funzt auch, allerdings dauert das alles sehr sehr lange > 2min
Kann ich das Makro optimieren ??
Code:
Sub aktualisieren_gelb()
Range("J8").Select
Do
If ActiveCell.Value = 1 Or ActiveCell.Offset(0, 29) = 1 Then 'Abtei
ActiveCell.Offset(0, 29) = 1
Else
ActiveCell.Offset(0, 29) = ""
End If
If ActiveCell.Value = 1 Or ActiveCell.Offset(0, 30) = 1 Then 'Freim
ActiveCell.Offset(0, 30) = 1
Else
ActiveCell.Offset(0, 30) = ""
End If
If ActiveCell.Value = 1 Then 'Rett
ActiveCell.Offset(0, 40) = 1
Else
ActiveCell.Offset(0, 40) = ""
End If
If ActiveCell.Value = 1 Then 'Al Eq
ActiveCell.Offset(0, 41) = 1
Else
ActiveCell.Offset(0, 41) = ""
End If
ActiveCell.Offset(1, 0).Select '1 Zelle nach unten
Loop Until ActiveCell.Offset(0, -8) = ""
'Vorwahl Ar
Range("H8").Select
Do
If ActiveCell.Value = 1 Then
ActiveCell.Offset(0, 31) = 1
End If
If ActiveCell.Value = 1 Then
ActiveCell.Offset(0, 44).Interior.ColorIndex = 6 'gelb
Else
ActiveCell.Offset(0, 44).Interior.ColorIndex = 0 'neutral
End If
If ActiveCell.Value = 1 Then
ActiveCell.Offset(0, 45).Interior.ColorIndex = 6 'gelb
Else
ActiveCell.Offset(0, 45).Interior.ColorIndex = 0 'neutral
End If
ActiveCell.Offset(1, 0).Select '1 Zelle nach unten
Loop Until ActiveCell.Offset(0, -6) = ""
'Springe nach externe Mitarbeiter
Range("Ao8").Select
Do
If ActiveCell.Value >= 1 Then
ActiveCell.Offset(0, 1).Interior.ColorIndex = 6 'gelb
ActiveCell.Offset(0, 2).Interior.ColorIndex = 6 'gelb
ActiveCell.Offset(0, 3).Interior.ColorIndex = 6 'gelb
ActiveCell.Offset(0, 4).Interior.ColorIndex = 6 'gelb
ActiveCell.Offset(0, 5).Interior.ColorIndex = 6 'gelb
ActiveCell.Offset(0, 6).Interior.ColorIndex = 6 'gelb
ActiveCell.Offset(0, 7).Interior.ColorIndex = 6 'gelb
ActiveCell.Offset(0, 8).Interior.ColorIndex = 6 'gelb
Else
ActiveCell.Offset(0, 1).Interior.ColorIndex = 0 'neutral
ActiveCell.Offset(0, 2).Interior.ColorIndex = 0 'neutral
ActiveCell.Offset(0, 3).Interior.ColorIndex = 0 'neutral
ActiveCell.Offset(0, 4).Interior.ColorIndex = 0 'neutral
ActiveCell.Offset(0, 5).Interior.ColorIndex = 0 'neutral
ActiveCell.Offset(0, 6).Interior.ColorIndex = 0 'neutral
ActiveCell.Offset(0, 7).Interior.ColorIndex = 0 'neutral
ActiveCell.Offset(0, 8).Interior.ColorIndex = 0 'neutral
End If
ActiveCell.Offset(1, 0).Select '1 Zelle nach unten
Loop Until ActiveCell.Offset(0, -39) = ""
'Springe nach oben
Range("A8").Select
'Lösche Daten Zwischenablage
Application.CutCopyMode = False
End Sub