Formattazione pesante



  • Formattazione pesante
    di Anto65 (utente non iscritto) data: 11/04/2010

    Salve a tutti.
    chiedo aiuto per poter velocizzare questa operazione:
    ho la necessità di formattare il colore delle celle di un area molto estesa che corrispondino ad una certa condizione, il fatto è che per ogni singola cella ci vuole un tempo di elaborazione infinito , ci sarebbe qualche soluzione ?
    grazie per un eventuale aiuto.



     
     
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim CL As Object
    For Each CL In Range("Q18:R135")  'per ogni cella in A1:F100
    If CL.Value = "ST1" Then     'se il valore della cella è uguale ad A
    CL.Interior.ColorIndex = 41    'mi metti il colore del carattere uguale a rosso, 'ecc. ecc.
    ElseIf CL.Value = "ST2" Then   'se invece il valore è uguale a B ecc.ecc
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST3" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST4" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST5" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST6" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST7" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST8" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST9" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST10" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST11" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST12" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST13" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST14" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST15" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST16" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST17" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST18" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST19" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST20" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST21" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST22" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST23" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST24" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST25" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST26" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST27" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST28" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST29" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "ST30" Then
    CL.Interior.ColorIndex = 41
    ElseIf CL.Value = "A1" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A2" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A1" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A3" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A4" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A5" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A6" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A7" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A8" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A9" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A10" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A11" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A12" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A13" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A14" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A15" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A16" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A17" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A18" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A19" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A20" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A21" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A22" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A23" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A24" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A25" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A26" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A27" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A28" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A29" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "A30" Then
    CL.Interior.ColorIndex = 34
    ElseIf CL.Value = "B1" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B2" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B3" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B4" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B5" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B6" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B7" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B8" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B9" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B10" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B11" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B12" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B13" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "B14" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C1" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C2" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C3" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C4" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C5" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C6" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C7" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C8" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C9" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C10" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C11" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C12" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C13" Then
    CL.Interior.ColorIndex = 36
    ElseIf CL.Value = "C14" Then
    CL.Interior.ColorIndex = 36
    End If
    Next
    End Sub