lunedì 29 settembre 2014

Scrittura in rosso dei turni straordinari

Ora devo individuare come fare per catturare i multipli di tre, nei punteggi che figurano nella tabella.

Sembra di aver risolto...
Sub calcola()
    Dim x As Range
    Set x = Range("ListaNomiMese").Find(lastcaption)
    If x Is Nothing = False Then
        x.Offset(0, 2).Formula = x.Offset(0, 2).Formula - 1
        Straordinario x
    End If
    Set x = Range("ListaNomiMese").Find(Bersaglio.Formula)
    If x Is Nothing = False Then
        x.Offset(0, 2).Formula = x.Offset(0, 2).Formula + 1
        Straordinario x
    End If
End Sub

Private Sub Straordinario(x As Range)
    If x.Offset(0, 2).Formula Mod 4 = 0 Then
        colore = vbRed
    Else
        colore = vbBlack
    End If
    Bersaglio.Font.Color = colore
End Sub
Sì, funziona! Praticamente ogni tre turni ne scrive uno, sul Calendario, in rosso, a significare un turno straordinario.

Nessun commento:

Posta un commento