marcoVince ha scritto:proporrei di cambiare il tuo nick in Mago Merlino
Grazie! Ma preferisco Flash
Mi sono accorto che ho inserito una condizione che non occorreva (bastava rifletterci su dopo una "boccata d'aria")
e più precisamente
- Codice: Seleziona tutto
If Col = 31 Then
Col = 32
GoTo colora
End If
Mettendo il Range("L2:AF" & UR) alla colonna AF (32ª colonna) invece di AE
quindi puoi sostituire la macro precedente con questa
- Codice: Seleziona tutto
Sub CompilaEColora()
Columns("L:AE").Clear
UR = Worksheets("Foglio1").Range("A" & Rows.Count).End(xlUp).Row
For RNum = 2 To UR
For CNum = 1 To 10
Vnum = Cells(RNum, CNum).Value
Cells(RNum, 11 + Vnum).Value = Vnum
Next CNum
Next RNum
Conta = 0
Col = 0
Riga = 0
For Each C In Range("L2:AF" & UR)
Col = C.Column
Riga = C.Row
If C.Value <> "" Then
Conta = Conta + 1
Else
If Col = 12 Then Conta = 0
Cells(Riga, Col).Interior.ColorIndex = xlNone
Select Case Conta
Case 1
Cells(Riga, Col - 1).Interior.ColorIndex = 38
Case 2
Range(Cells(Riga, Col - 2), Cells(Riga, Col - 1)).Interior.ColorIndex = 4
Case 3
Range(Cells(Riga, Col - 3), Cells(Riga, Col - 1)).Interior.ColorIndex = 6
Case 4
Range(Cells(Riga, Col - 4), Cells(Riga, Col - 1)).Interior.ColorIndex = 45
Case 5
Range(Cells(Riga, Col - 5), Cells(Riga, Col - 1)).Interior.ColorIndex = 3
Case 6
Range(Cells(Riga, Col - 6), Cells(Riga, Col - 1)).Interior.ColorIndex = 15
Case 7
Range(Cells(Riga, Col - 7), Cells(Riga, Col - 1)).Interior.ColorIndex = 48
Case 8
Range(Cells(Riga, Col - 8), Cells(Riga, Col - 1)).Interior.ColorIndex = 16
Case 9
Range(Cells(Riga, Col - 9), Cells(Riga, Col - 1)).Interior.ColorIndex = 1
Range(Cells(Riga, Col - 9), Cells(Riga, Col - 1)).Font.ColorIndex = 36
Case 10
Range(Cells(Riga, Col - 10), Cells(Riga, Col - 1)).Interior.ColorIndex = 1
Range(Cells(Riga, Col - 10), Cells(Riga, Col - 1)).Font.ColorIndex = 3
End Select
Conta = 0
End If
Next C
End Sub
Ciao