Moderatori: Anthony47, Flash30005
Sub SpalmaFE()
Dim tSh As Worksheet, gSh As Worksheet
Dim rDate As Range, rHoli As Range, rNomi As Range
Dim dMatch, nMatch, hMatch
Dim I As Long, J As Date
'
Set tSh = Sheets("globale_FE")
Set gSh = Sheets("generale")
Set rDate = tSh.Range("A5").Resize(1, 500)
Set rHoli = gSh.Range("T7:T30")
Set rNomi = tSh.Range("E6:E100")
gSh.Select
For I = 7 To Cells(Rows.Count, "I").End(xlUp).Row
If Cells(I, "I") = "FE" Then
For J = Cells(I, "F") To Cells(I, "G")
If Weekday(J, vbMonday) < 6 Then
hMatch = Application.Match(CLng(J), rHoli, False)
If IsError(hMatch) Then
nMatch = Application.Match(Cells(I, "D"), rNomi, False)
dMatch = Application.Match(CLng(J), rDate, False)
If Not IsError(nMatch) And Not IsError(dMatch) Then
tSh.Cells(5 + nMatch, dMatch).Value = "FE"
tSh.Cells(5 + nMatch, dMatch).Interior.Color = RGB(0, 255, 0)
End If
End If
End If
Next J
End If
Next I
End Sub
Anche i Festivi? E poi: ci possono essere celle di altri colori che devono rimanere? E possono esserci celle colorate ma non contenenti "FE"?vorrei cancellare i dati e togliere lo sfondo vende
nelle giornate LUN_SAB
Sub SpalmaFE()
Dim tSh As Worksheet, gSh As Worksheet
Dim rDate As Range, rHoli As Range, rNomi As Range
Dim dMatch, nMatch, hMatch
Dim I As Long, J As Date
Dim nCtn As Long, fWd As Long '+++
'
Set tSh = Sheets("globale_FE")
Set gSh = Sheets("generale")
Set rDate = tSh.Range("A5").Resize(1, 500)
Set rHoli = gSh.Range("T7:T30")
Set rNomi = tSh.Range("E6:E100")
gSh.Select
' '>>>+++
nCtn = rNomi.Cells(1000, 1).End(xlUp).Row - 5
fWd = Weekday(rDate.Cells(1, 6), 2)
If fWd < 7 Then
rDate.Cells(2, 6).Resize(nCtn, 7 - fWd).ClearContents
rDate.Cells(2, 6).Resize(nCtn, 7 - fWd).Interior.Color = xlNone
End If
For I = 6 + 8 - fWd To 500 Step 7
rDate.Cells(2, I).Resize(nCtn, 6).ClearContents
rDate.Cells(2, I).Resize(nCtn, 6).Interior.Color = xlNone
Next I
'<<<+++
'
For I = 7 To Cells(Rows.Count, "I").End(xlUp).Row 'ESISTENTE
'etc
'etc
Torna a Applicazioni Office Windows
Sincronizzazione Google Outlook calendario=no va!!!! Autore: mp420 |
Forum: Software Windows Risposte: 1 |
Visitano il forum: Nessuno e 10 ospiti