ciao
in un file ho 12 fogli con i nomi dei mesi.
ho una macro che quando la avvio opera sul foglio attivo
-----
Sub coloro1()
If [b6] = "" Then
MsgBox "il mese e' vuoto...", vbCritical
'--------------------------
'RIATTIVO LE APPLICATION
With Application
.Calculation = xlCal
.EnableEvents = True
.ScreenUpdating = True
End With
'-----------------------------------
Exit Sub
End If
'---coloro 18,30----------------
RRs = 2
CCs = 24 ' colonna =X
NumS = Cells(RRs, CCs).Value
For RRT = 6 To 105
For cct = 8 To 38 ' 37=col Ay
If Cells(RRT, cct).Value = NumS Then
With Cells(RRT, cct)
.Interior.ColorIndex = 8 'colore cella
.Font.ColorIndex = 1 ' colore carattere
End With
End If
Next cct
Next RRT
'---coloro BASE----------------
RRs = 2
CCs = 23 ' colonna W
NumS = Cells(RRs, CCs).Value
For RRT = 6 To 105
For cct = 8 To 38
If Cells(RRT, cct).Value = NumS Then
With Cells(RRT, cct)
.Interior.ColorIndex = 36 'colore cella
.Font.ColorIndex = 1 ' colore carattere
End With
End If
Next cct
Next RRT
'---coloro 20----------------
RRs = 2
CCs = 25 ' colonna =Y
NumS = Cells(RRs, CCs).Value
For RRT = 6 To 105
For cct = 8 To 38
If Cells(RRT, cct).Value = NumS Then
With Cells(RRT, cct)
.Interior.ColorIndex = 1 'colore cella
.Font.ColorIndex = 19 ' colore carattere
End With
End If
Next cct
Next RRT
'---coloro r1 rep merc----------------
RRs = 2
CCs = 26 ' colonna =Z
NumS = Cells(RRs, CCs).Value
For RRT = 6 To 105
For cct = 8 To 38
If Cells(RRT, cct).Value = NumS Then
With Cells(RRT, cct)
.Interior.ColorIndex = 4 'colore cella
.Font.ColorIndex = 1 ' colore carattere
End With
End If
Next cct
Next RRT
'---coloro r2 rep domen----------------
RRs = 2
CCs = 27 ' colonna =AA
NumS = Cells(RRs, CCs).Value
For RRT = 6 To 105
For cct = 8 To 38
If Cells(RRT, cct).Value = NumS Then
With Cells(RRT, cct)
.Interior.ColorIndex = 7 'colore cella
.Font.ColorIndex = 1 ' colore carattere
End With
End If
Next cct
Next RRT
'----adatto largh col-----------------------
Columns("C:Al").ColumnWidth = 4
Columns("g").ColumnWidth = 1
Range("AK1").Select
'-------------
Call evidenziaB ' metto cornice b3-b2
Call EvidenziaLL ' evidenzio LL dal lun.ven
'-----------
Range("a2").Select
ActiveWindow.DisplayGridlines = False 'protegge il fgl
End Sub
----------------
vorrei poter aggiungere un ciclo , in modo che quando sono in un mese qualunque ed avvio tale macro
questa operi anche sugli altri 11 mesi.
via allego il file:
https://dl.dropboxusercontent.com/u/96374724/raggruppo%20turni.rar
https://dl.dropboxusercontent.com/u/96374724/raggruppo%20turni.rar
grazie - ciao
[Modificato da raimea 28/03/2016 10:08]
wind 10 & office 2010