
Sub PROVA()
'
' PROVA Macro
'
Sheets("INSERIMENTO DATI").Select
fpath = "C:"
For n = 23 To 41
For m = 23 To 41
Range("B4").Value = Range("AV" & n).Value
Range("F4").Value = Range("AV" & m).Value
Do
For a = 4 To 10
For b = 7 To 8
Range("N4").Value = Range("BM" & a).Value
Range("O4").Value = Range("BQ" & b).Value
If Range("V4").Value > Range("V8").Value Then Exit Do
Next
Next
"se la condizione If non è verificata scrivi:"
Range("N4").Value = "NV"
Range("O4").Value = "NV"
"e vai direttamente alla riga 138 (salvataggio file)"
Exit Do
Loop
Do
For a = 10 To 40
Range("Z5").Value = a
If Range("V5").Value > Range("V8").Value Then Exit Do
Next
Range("Z5").Value = "NV"
Exit Do
Loop
Do
For a = 10 To 40
Range("Z6").Value = a
If Range("V6").Value > Range("V8").Value Then Exit Do
Next
Range("Z6").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K31").Value
Range("Z11").Value = Range("B9").Value + a
If Range("V11").Value > Range("V8").Value Then Exit Do
Next
Range("Z11").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K31").Value
Range("Z12").Value = Range("B9").Value + a
If Range("V12").Value > Range("V8").Value Then Exit Do
Next
Range("Z12").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K30").Value
Range("Z15").Value = Range("B11").Value + a
If Range("V15").Value > Range("V8").Value Then Exit Do
Next
Range("Z15").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K30").Value
Range("Z18").Value = Range("B11").Value + a
If Range("V18").Value > Range("V8").Value Then Exit Do
Next
Range("Z18").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K32").Value
Range("Z21").Value = Range("F9").Value + a
If Range("V21").Value > Range("V8").Value Then Exit Do
Next
Range("Z21").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K30").Value
Range("Z24").Value = Range("B11").Value + a
If Range("V24").Value > Range("V8").Value Then Exit Do
Next
Range("Z24").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K33").Value
Range("Z27").Value = Range("F11").Value + a
If Range("V27").Value > Range("V8").Value Then Exit Do
Next
Range("Z27").Value = "NV"
Exit Do
Loop
ActiveWorkbook.SaveAs Filename:= _
fpath & Range("AV" & n).Value & Range("AV" & m).Value & ".xls", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
Next
Next
End Sub
|
Sub copiaFREQUENZEPOISSON()
Dim r As Integer, y As Integer, A As Variant, B As Integer C As,Integer
Application.ScreenUpdating = False
'Application.Calculation = xlCalculationManual
Sheets("COPIAPOISSON").Select
A = 3
C= 2
Range("B1") = Cells(2, 2)
'--1° CICLO DI 6 CAMPIONATI X 6 NAZIONI ESEMPIO ITALIA 2010, ITALIA 2011 .. GERMANIA 2010 GERMANIA 2011.. GERMANIA 2015
For r = 1 To 36
Range("B1") = Cells(r + 1, 2) '---assegno alla cella B1 nome e anno del primo campionato.Con delle formule collegate a questa cella carico tutte le partite con relativi risultati.
'-----------------------------------------INIZIO ISTRUZIONI X ELIMINARE DUPLICATI SQUADRE
Range("E2:E61").Select
Selection.Copy
Range("B40").Select
Selection.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
ActiveSheet.Range("$B$40:$B$99").RemoveDuplicates Columns:=1, Header:=xlNo
'-------------------------------------------FINE ELIMINA DUPLICATI----INIZIO CICLO ASSEGNAZIONE VALORE ALLE CELLE AD1,AE1
B = Range("A1") 'numero di partite giocate in questo campionato, 380
For y = 1 To B
Range("AD1") = Cells(y + 1, 16) 'acquisisce di volta in volta tutti i 380 valori del relativo campionato caricato
Range("AE1") = Cells(y + 1, 22) 'acquisisce di volta in volta tutti i 380 valori
-----------------------INIZIO FASE ELABORAZIONE SEMPRE STESSO FOGLIO
Range("OJ572:OY572").Select '---------------------ottengo il risultato elaborato nell'intervallo
Selection.Copy '------------------------------- copio il risultato nella cella AF2 dello stesso foglio
Cells(C, 32).Select
Selection.PasteSpecial Paste:=xlPasteValues
C = (1 + C)
Next Y
'----- FINE ASSEGNAZIONI DI TUTTI I 380 VALORI ALLE CELLE AD1 AE1'
Range("dx485:if486").Select
'-----------'FINE FASE ELABORAZIONE OTTENGO RISULTATO CHE COPIERO NEL FOGLIO COPIARISULTATI POISSON
Selection.Copy
Sheets("COPIARISULTATIPOISSON").Select
Cells(A, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues
A = (2 + A)
Sheets("COPIAPOISSON").Select
Next r
Application.ScreenUpdating = True
'Application.Calculation = xlCalculationAutomatic
End Sub
|
Sub PROVA()
'
' PROVA Macro
'
Sheets("INSERIMENTO DATI").Select
fpath = "C:"
For n = 23 To 41
For m = 23 To 41
Range("B4").Value = Range("AV" & n).Value
Range("F4").Value = Range("AV" & m).Value
Do
For a = 4 To 10
For b = 7 To 8
Range("N4").Value = Range("BM" & a).Value
Range("O4").Value = Range("BQ" & b).Value
If Range("V4").Value > Range("V8").Value Then
Exit Do
else
Range("N4").Value = "NV"
Range("O4").Value = "NV"
GoTo 10
Next
Next
Loop
Do
For a = 10 To 40
Range("Z5").Value = a
If Range("V5").Value > Range("V8").Value Then Exit Do
Next
Range("Z5").Value = "NV"
Exit Do
Loop
Do
For a = 10 To 40
Range("Z6").Value = a
If Range("V6").Value > Range("V8").Value Then Exit Do
Next
Range("Z6").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K31").Value
Range("Z11").Value = Range("B9").Value + a
If Range("V11").Value > Range("V8").Value Then Exit Do
Next
Range("Z11").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K31").Value
Range("Z12").Value = Range("B9").Value + a
If Range("V12").Value > Range("V8").Value Then Exit Do
Next
Range("Z12").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K30").Value
Range("Z15").Value = Range("B11").Value + a
If Range("V15").Value > Range("V8").Value Then Exit Do
Next
Range("Z15").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K30").Value
Range("Z18").Value = Range("B11").Value + a
If Range("V18").Value > Range("V8").Value Then Exit Do
Next
Range("Z18").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K32").Value
Range("Z21").Value = Range("F9").Value + a
If Range("V21").Value > Range("V8").Value Then Exit Do
Next
Range("Z21").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K30").Value
Range("Z24").Value = Range("B11").Value + a
If Range("V24").Value > Range("V8").Value Then Exit Do
Next
Range("Z24").Value = "NV"
Exit Do
Loop
Do
For a = 0 To Range("K33").Value
Range("Z27").Value = Range("F11").Value + a
If Range("V27").Value > Range("V8").Value Then Exit Do
Next
Range("Z27").Value = "NV"
Exit Do
Loop
10:
ActiveWorkbook.SaveAs Filename:= _
fpath & Range("AV" & n).Value & Range("AV" & m).Value & ".xls", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
Next
Next
End Sub
|
Do
For a = 4 To 10
For b = 7 To 8
Range("N4").Value = Range("BM" & a).Value
Range("O4").Value = Range("BQ" & b).Value
If Range("V4").Value > Range("V8").Value Then Exit Do
Next
Next
Range("N4").Value = "NV"
Range("O4").Value = "NV"
GoTo 10
Loop
|
