Moderatori: Anthony47, Flash30005
Sub Riep()
Dim StarD As Range, StarW As Range, StarOut As Range
Dim oArr(), lunDat As Long, oInd As Long, i As Long
Dim MinDa As Long, MaxDa As Long
'
'Definizioni:
Set StarD = Sheets("dalambert").Range("B6")
Set StarW = Sheets("dalambert").Range("W6")
Set StarOut = Sheets("Squadre").Range("AG7")
'
lunDat = StarD.Offset(10000, 0).End(xlUp).Row - StarD.Row + 1
MinDa = Application.WorksheetFunction.Min(StarD.Resize(lunDat, 1))
MaxDa = Application.WorksheetFunction.Max(StarD.Resize(lunDat, 1))
'Raccoglie dati:
ReDim oArr(MinDa To MaxDa, 1 To 2)
For i = 1 To lunDat
If IsDate(StarD.Cells(i, 1)) Then
oArr(StarD.Cells(i, 1), 1) = StarD.Cells(i, 1)
oArr(StarD.Cells(i, 1), 2) = oArr(StarD.Cells(i, 1), 2) + StarW.Cells(i, 1)
End If
Next i
'Scrivi risultati:
StarOut.Offset(1, 0).Resize(lunDat, 2).Clear
For i = LBound(oArr) To UBound(oArr)
If oArr(i, 1) <> "" Then
oInd = oInd + 1
StarOut.Cells(oInd, 1) = CDate(oArr(i, 1))
StarOut.Cells(oInd, 2) = oArr(i, 2)
End If
Next i
'Format:
StarOut.Range("A1:B1").Copy
StarOut.Resize(oInd, 2).PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
End Sub
Sub RiepZZ()
Dim StarD As Range, StarW As Range, StarOut As Range
Dim oArr(), lunDat As Long, oInd As Long, i As Long
Dim MinDa As Long, MaxDa As Long
'
'Definizioni:
Set StarD = Sheets("dalambert").Range("B6")
Set StarW = Sheets("dalambert").Range("W6")
Set StarOut = Sheets("Squadre").Range("AG7")
'
lunDat = StarD.Offset(10000, 0).End(xlUp).Row - StarD.Row + 1
MinDa = Application.WorksheetFunction.Min(StarD.Resize(lunDat, 1))
MaxDa = Application.WorksheetFunction.Max(StarD.Resize(lunDat, 1))
'Raccoglie dati:
ReDim oArr(MinDa To MaxDa, 1 To 5)
For i = 1 To lunDat
If IsDate(StarD.Cells(i, 1)) Then
oArr(StarD.Cells(i, 1), 1) = StarD.Cells(i, 1)
oArr(StarD.Cells(i, 1), 2) = oArr(StarD.Cells(i, 1), 2) + StarW.Cells(i, 1)
oArr(StarD.Cells(i, 1), 3) = oArr(StarD.Cells(i, 1), 3) + 1
If StarW.Cells(i, -5) = "Vinto" Then
oArr(StarD.Cells(i, 1), 4) = oArr(StarD.Cells(i, 1), 4) + 1
Else
oArr(StarD.Cells(i, 1), 5) = oArr(StarD.Cells(i, 1), 5) + 1
End If
End If
Next i
'Scrivi risultati:
StarOut.Offset(1, 0).Resize(lunDat, 5).Clear
For i = LBound(oArr) To UBound(oArr)
If oArr(i, 1) <> "" Then
oInd = oInd + 1
For j = 1 To 5
If j = 1 Then
StarOut.Cells(oInd, 1) = CDate(oArr(i, 1))
Else
StarOut.Cells(oInd, j) = oArr(i, j)
End If
Next j
End If
Next i
'Format:
StarOut.Range("A1:E1").Copy
StarOut.Resize(oInd, 5).PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
End Sub
Sub Resa_giorno()
Dim StarD As Range, StarW As Range, StarOut As Range
Dim OArr(), lunDat As Long, oInd As Long, i As Long
Dim MinDa As Long, MaxDa As Long
'--------------------------------------
' febbraio 23 da pc-facile by antony
' serve fare la resa giornaliera
' http://www.pc-facile.com/forum/viewtopic.php?f=26&t=112821&p=663242#p663242
'-----------------------------------
inizio = Timer
UserForm1.Show vbModeless
DoEvents
''Application.ScreenUpdating = False 'blocca sfarfallio e non vedo cambiare fgl
'Definizioni:
Set StarD = Sheets("dalambert").Range("B6")
Set StarW = Sheets("dalambert").Range("W6")
Set StarOut = Sheets("tabelle").Range("AG7")
'
lunDat = StarD.Offset(10000, 0).End(xlUp).Row - StarD.Row + 1
MinDa = Application.WorksheetFunction.Min(StarD.Resize(lunDat, 1))
MaxDa = Application.WorksheetFunction.Max(StarD.Resize(lunDat, 1))
'Raccoglie dati:
ReDim OArr(MinDa To MaxDa, 1 To 6)
Dim cData As Long, cCassa As Single
For i = 1 To lunDat
If IsDate(StarD.Cells(i, 1)) Then
cCassa = StarW.Cells(i, -2)
cData = Int(StarD.Cells(i, 1).Value)
If Int(StarD.Cells(i, 1).Value) <> oData Then
If i > 1 Then OArr(oData, 6) = StarW.Cells(i - 1, -2)
oData = cData
End If
OArr(StarD.Cells(i, 1), 1) = StarD.Cells(i, 1)
OArr(StarD.Cells(i, 1), 2) = OArr(StarD.Cells(i, 1), 2) + StarW.Cells(i, 1)
OArr(StarD.Cells(i, 1), 3) = OArr(StarD.Cells(i, 1), 3) + 1
If StarW.Cells(i, -5) = "Vinto" Then
OArr(StarD.Cells(i, 1), 4) = OArr(StarD.Cells(i, 1), 4) + 1
Else
OArr(StarD.Cells(i, 1), 5) = OArr(StarD.Cells(i, 1), 5) + 1
End If
End If
Next i
If i > 1 And cData > 0 Then
OArr(oData, 6) = cCassa
End If
'Scrivi risultati:
StarOut.Offset(1, 0).Resize(lunDat, 6).Clear
For i = LBound(OArr) To UBound(OArr)
If OArr(i, 1) <> "" Then
oInd = oInd + 1
For J = 1 To 6
If J = 1 Then
StarOut.Cells(oInd, 1) = CDate(OArr(i, 1))
Else
StarOut.Cells(oInd, J) = OArr(i, J)
End If
Next J
End If
Next i
'Format:
StarOut.Range("A1:F1").Copy
StarOut.Resize(oInd, 6).PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
'----- sistemo metto griglia----------------------
Range("AG7:AK5000").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDash
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlDouble
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlDash
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
'-------coloro riga si no --------------------------------
For Z = 7 To Cells(Rows.Count, "AG").End(xlUp).Row ' 7 1ma riga
Range("AG7:AK1000").Interior.ColorIndex = 2 '<<< sfondo bianco
Range("AG7:AK1000").Font.Bold = False
Next Z
For RR = 7 To Z Step 2
Range("AG" & RR & ":AK" & RR).Interior.ColorIndex = 36
Range("AG" & RR & ":AK" & RR).Font.Bold = True
Next RR
'------------------
Application.ScreenUpdating = True ' riattiva sfarfallio
Unload UserForm1
fine = Timer
MsgBox ("Tempo impiegato " & Int((fine - inizio) / 60) & " min " & (fine - inizio) Mod 60 & " Sec")
End Sub
If StarW.Cells(i, -4) = "Vinta" Then
If StarW.Cells(i, -4) = "Vinta" Then
'Raccoglie dati:
ReDim oArr(MinDa To MaxDa, 1 To 6)
Dim cData As Long, cCassa As Single
For i = 1 To lunDat
If IsDate(StarD.Cells(i, 1)) Then
' cCassa = StarW.Cells(i, -2)
cData = Int(StarD.Cells(i, 1).Value)
' If Int(StarD.Cells(i, 1).Value) <> oData Then
' If i > 1 Then oArr(oData, 6) = StarW.Cells(i - 1, -2)
' oData = cData
' End If
If cData > 0 Then
oArr(cData, 6) = StarW.Cells(i, 2)
oArr(cData, 1) = StarD.Cells(i, 1)
oArr(cData, 2) = oArr(StarD.Cells(i, 1), 2) + StarW.Cells(i, 1)
oArr(cData, 3) = oArr(StarD.Cells(i, 1), 3) + 1
If StarW.Cells(i, -4) = "Vinta" Then
oArr(cData, 4) = oArr(cData, 4) + 1
Else
oArr(cData, 5) = oArr(cData, 5) + 1
End If
End If
End If
Next i
'If i > 1 And cData > 0 Then
' oArr(oData, 6) = cCassa
'End If
'Scrivi risultati:
Torna a Applicazioni Office Windows
Visitano il forum: Nessuno e 18 ospiti