Advertisement
Guest User

Untitled

a guest
Jun 13th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. Dim myTab19 As String
  3. myTab19 = "l41:r69"
  4. If Not Application.Intersect(Target, Range(myTab19)) Is Nothing And Sheets("Barbaro").Range("b8").Value <> 0 Then
  5. Range(myTab19).Copy Destination:=Sheets("tiri nascosti").Range("h29")
  6.  
  7. End If
  8. Dim Indice As Integer
  9. Dim Indice01 As Integer
  10. Dim Indice02 As Integer
  11. Dim Vettore(1 To 10, 1 To 2)
  12. Dim Risultati(1 To 10, 1 To 2)
  13. Dim CellaW
  14.  
  15.  
  16. Risultati(1, 1) = "Barbaro"
  17. Set Risultati(1, 2) = ActiveWorkbook.Sheets("mod").Range("L2:L21")
  18. Risultati(2, 1) = "Guerriero"
  19. Set Risultati(2, 2) = ActiveWorkbook.Sheets("mod").Range("L24:L43")
  20. Risultati(3, 1) = "Monaco"
  21. Set Risultati(3, 2) = ActiveWorkbook.Sheets("mod").Range("L46:L65")
  22. Risultati(4, 1) = "Stregone"
  23. Set Risultati(4, 2) = ActiveWorkbook.Sheets("mod").Range("L68:L87")
  24. Risultati(5, 1) = "Bardo"
  25. Set Risultati(5, 2) = ActiveWorkbook.Sheets("mod").Range("O2:O21")
  26. Risultati(6, 1) = "Ladro"
  27. Set Risultati(6, 2) = ActiveWorkbook.Sheets("mod").Range("O24:O43")
  28. Risultati(7, 1) = "Paladino"
  29. Set Risultati(7, 2) = ActiveWorkbook.Sheets("mod").Range("O45:O65")
  30. Risultati(8, 1) = "Druido"
  31. Set Risultati(8, 2) = ActiveWorkbook.Sheets("mod").Range("R2:R21")
  32. Risultati(9, 1) = "Mago"
  33. Set Risultati(9, 2) = ActiveWorkbook.Sheets("mod").Range("R24:R43")
  34. Risultati(10, 1) = "Ranger"
  35. Set Risultati(10, 2) = ActiveWorkbook.Sheets("mod").Range("R46:R65")
  36.  
  37. For Indice = 1 To 10
  38. Vettore(Indice, 1) = ActiveWorkbook.Sheets("Barbaro").Range("C38").Offset((Indice) * 3, 1)
  39. Vettore(Indice, 2) = ActiveWorkbook.Sheets("Barbaro").Range("C38").Offset((Indice) * 3, 9)
  40. If Not IsNumeric(Vettore(Indice, 2)) Then
  41. MsgBox "livello non numerico"
  42. Exit Sub
  43. End If
  44. Next Indice
  45.  
  46. For Indice01 = 1 To 10
  47. For Indice02 = 1 To 10
  48. If Risultati(Indice01, 1) = Vettore(Indice02, 1) Then
  49. For Each CellaW In Risultati(Indice01, 2)
  50. If CellaW.Value <= Vettore(Indice02, 2) Then
  51. If CellaW.Offset(0, 1) <> "" Then
  52.  
  53. ActiveWorkbook.Sheets("Barbaro2").Range("H52").End(xlUp).Offset(1, 0) = CellaW.Offset(0, 1).Text
  54. End If
  55. End If
  56. Next CellaW
  57. End If
  58. Next Indice02
  59. Next Indice01
  60. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement