Thema Datum  Von Nutzer Rating
Antwort
18.12.2018 11:44:30 Lemmi
NotSolved
18.12.2018 17:57:17 Mackie
NotSolved
18.12.2018 18:15:40 Lemmi
NotSolved
18.12.2018 18:55:28 Mackie
NotSolved
18.12.2018 19:04:08 Lemmi
NotSolved
18.12.2018 19:05:02 Gast69909
NotSolved
18.12.2018 19:26:27 Lemmi
NotSolved
Blau Aufeinanderfolgende Farben umformatieren (Excel)
18.12.2018 19:34:25 Gast88351
Solved
18.12.2018 19:50:28 Lemmi
NotSolved

Ansicht des Beitrags:
Von:
Gast88351
Datum:
18.12.2018 19:34:25
Views:
477
Rating: Antwort:
 Nein
Thema:
Aufeinanderfolgende Farben umformatieren (Excel)

Schlicht und ergreifend so

Option Explicit

Sub Test()
Dim x As Long
Dim strAddi As String
Dim rngSpalte As Range, rngSame As Range, rngA As Range

Application.ScreenUpdating = False
   
   For Each rngSpalte In Range("A1:K11000").Columns
      Set rngSame = Tushar_Mehta(rngSpalte)
      If Not rngSame Is Nothing Then
         For Each rngA In rngSame.Areas
            Select Case rngA.Rows.Count
               Case 2
                  rngA.Interior.Color = RGB(255, 0, 0)
               Case 5
                  rngA.Interior.Color = RGB(0, 0, 255)
               Case Else
                  '
            End Select
         Next rngA
      End If
   Next rngSpalte

   Application.FindFormat.Clear
   Application.ScreenUpdating = True

End Sub


Private Function Tushar_Mehta(Rng As Range) As Range
'frei nach http://www.tushar-mehta.com
Dim FirstCell As Range
Dim CurrCell As Range
Dim rngU As Range

   With Application.FindFormat
      .Clear
      With .Interior
         .Color = RGB(0, 255, 0)
      End With
   End With

   Set FirstCell = Rng.Cells.Find(What:="", After:=Rng.Cells(1), _
      LookIn:=xlFormulas, LookAt:=xlPart, _
      SearchOrder:=xlByRows, SearchDirection:=xlNext, _
      MatchCase:=False, SearchFormat:=True)
   
   If Not FirstCell Is Nothing Then
      Set CurrCell = FirstCell
      Set rngU = CurrCell
      Do
         Set CurrCell = Rng.Cells.Find(What:="", After:=CurrCell, _
            LookIn:=xlFormulas, LookAt:=xlPart, _
            SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False, SearchFormat:=True)
         If Not CurrCell Is Nothing Then Set rngU = Union(rngU, CurrCell)
      Loop Until CurrCell.Address = FirstCell.Address
      Set Tushar_Mehta = rngU
   End If

End Function

 


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
18.12.2018 11:44:30 Lemmi
NotSolved
18.12.2018 17:57:17 Mackie
NotSolved
18.12.2018 18:15:40 Lemmi
NotSolved
18.12.2018 18:55:28 Mackie
NotSolved
18.12.2018 19:04:08 Lemmi
NotSolved
18.12.2018 19:05:02 Gast69909
NotSolved
18.12.2018 19:26:27 Lemmi
NotSolved
Blau Aufeinanderfolgende Farben umformatieren (Excel)
18.12.2018 19:34:25 Gast88351
Solved
18.12.2018 19:50:28 Lemmi
NotSolved