Moderatori: Anthony47, Flash30005
Sub CkHolid()
Dim HDArr, I As Long, mHoly, llFor
Dim LastW As Long, TWsh As Worksheet
'
llFor = Array("B", "1", "2") '<<< I Turni festivi da cercare
'
Sheets("Feste").Select
Set TWsh = Sheets(Range("D4").Value)
'
Range("D6").Resize(200, 30).ClearContents '<<< ??? azzera l'area dei risultati??
'
LastW = TWsh.Cells(Rows.Count, 1).End(xlUp).Row
HDArr = Range(Range("E5"), Range("E5").End(xlToRight)).Value
For I = 1 To UBound(HDArr, 2)
mHoly = Application.Match(CLng(HDArr(1, I)), TWsh.Range("A2").Resize(1, 1000), False)
If Not IsError(mHoly) Then
For j = 3 To LastW
' Debug.Print TWsh.Cells(j, mHoly).Address
If Not IsError(Application.Match(TWsh.Cells(j, mHoly).Value, llFor, False)) Then
mynext = Application.Match(TWsh.Cells(j, "D").Value, Range("D1").Resize(200, 1), False)
If IsError(mynext) Then
mynext = Cells(Rows.Count, "D").End(xlUp).Row + 1
Cells(mynext, "D").Value = TWsh.Cells(j, "D").Value
End If
Cells(mynext, 5 + I - 1).Value = TWsh.Cells(j, mHoly).Value
End If
Next j
End If
Next I
MsgBox ("Completato...")
End Sub
If Not IsError(mHoly) And HDArr(1, I) >= Range("D3").Value Then
LastW = TWsh.Cells(Rows.Count, 1).End(xlUp).Row
HDArr = Range(Range("E5"), Range("AZ5").End(xlToRight)).Value 'Riga Modificata
For I = 1 To UBound(HDArr, 2)
If HDArr(1, I) = "" Then Exit For 'Riga aggiunta
mHoly = Application.Match(CLng(HDArr(1, I)), TWsh.Range("A2").Resize(1, 1000), False)
Sub CkHolid()
Dim HDArr, I As Long, mHoly, llFor
Dim LastW As Long, TWsh As Worksheet
''-----------------------------------------------
' maggio 20 pc-facile
' serve prelevare chi di turno in festivita
' http://www.pc-facile.com/forum/viewtopic.php?f=26&t=111366&p=653980&sid=0ca4f906125bab64240af182d6271f8f#
'-------------------------------------------------
UserForm1.Show vbModeless ' attiva immagine attendi
DoEvents
llFor = Array("B", "1", "2", "R", "Reper.") '<<< I Turni festivi da cercare '###
'
Set TWsh = Sheets(Range("D4").Value)
'
Range("D6").Resize(200, 40).ClearContents '<<< ??? azzera l'area dei risultati?? fino riga 200 col 40
Range("D6").Resize(200, 40).Interior.Color = xlNone '<<< ??? azzera l'area dei risultati?? fino riga 200 col 40 '###
'
LastW = TWsh.Cells(Rows.Count, 1).End(xlUp).Row
HDArr = Range(Range("E5"), Range("AZ5").End(xlToRight)).Value ' AZ fin dove controlla
For I = 1 To UBound(HDArr, 2)
If HDArr(1, I) = "" Then Exit For
mHoly = Application.Match(CLng(HDArr(1, I)), TWsh.Range("A2").Resize(1, 1000), False)
If Not IsError(mHoly) And HDArr(1, I) >= Range("D3").Value Then ' control le date da D3 in avanti
' If Not IsError(mHoly) Then ' controlla tutte date non fa rif a D3
For J = 3 To LastW
' Debug.Print TWsh.Cells(j, mHoly).Address
If Not IsError(Application.Match(TWsh.Cells(J, mHoly).MergeArea.Cells(1, 1).Value, llFor, False)) Then '###
mynext = Application.Match(TWsh.Cells(J, "D").MergeArea.Cells(1, 1).Value, Range("D1").Resize(200, 1), False) '###
If IsError(mynext) Then
mynext = Cells(Rows.Count, "D").End(xlUp).Row + 1
Cells(mynext, "D").Value = TWsh.Cells(J, "D").MergeArea.Cells(1, 1).Value '###
End If
Cells(mynext, 5 + I - 1).Value = Left(TWsh.Cells(J, mHoly).MergeArea.Cells(1, 1).Value, 1) '###
If Cells(mynext, 5 + I - 1).Value = "R" Then Cells(mynext, 5 + I - 1).Interior.Color = RGB(255, 255, 200) '###
End If
Next J
End If
Next I
'---------------------------------------------------
Call Nomi_Noturni
'----------------------------------------------------
Unload UserForm1 ' chiude immag attendi
MsgBox ("Completato...")
End Sub
Torna a Applicazioni Office Windows
Macro modifica date scelta periodo Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 11 |
Excel: problema con date se devo unirle a testi Autore: valle1975 |
Forum: Applicazioni Office Windows Risposte: 5 |
EXCEL - Estrazione nome file senza estensione da percorso Autore: Dylan666 |
Forum: Applicazioni Office Windows Risposte: 6 |
Date CUP Web prenotabili su foglio excel Autore: aggittoriu |
Forum: Applicazioni Office Windows Risposte: 17 |
Visitano il forum: Nessuno e 13 ospiti