Private Sub ComboBox4_Click()
On Error Resume Next
Cells.Find(ComboBox4.Text, , , , xlByColumns).Select
Worksheets(ComboBox4.Text).Activate
End Sub
Private Sub ComboBox4_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
On Error Resume Next
Cells.Find(ComboBox4.Text, , , , xlByColumns).Select
Worksheets(ComboBox4.Text).Activate
End Sub
Private Sub ComboBox4_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ComboBox4.Text = ""
End Sub
Private Sub CommandButton1_Click()
If ComboBox1.Text = "" Or ComboBox2.Text = "" Then Exit Sub
If ComboBox4.Text = "" Then Exit Sub
N = TextBox2 - TextBox1
For X = 2 To FineA * 8 Step 8
If ComboBox1.Text = Worksheets(ComboBox4.Text).Cells(X, 1) Then
If Worksheets(ComboBox4.Text).Cells(X, ComboBox2.Value + 2) <> "" Then
Risp = MsgBox("La cella non è vuota, vuoi salvare lo stesso?", 4372, "Attenzione!!!")
If Risp = 7 Then Exit Sub
End If
If TextBox2 = TextBox1 Then
Risp = MsgBox(" I valori delle due celle sono identici!!! ", 69632, "Attenzione!!!")
Exit Sub
ElseIf TextBox2 < TextBox1 Then
Risp = MsgBox(" I valori delle due celle sono scambiati!!! ", 69632, "Attenzione!!!")
Exit Sub
ElseIf TextBox3 = "" Then Worksheets(ComboBox4.Text).Cells(X + 3, ComboBox2.Value + 2) = ""
ElseIf TextBox3 < TextBox1 Or TextBox3 > TextBox2 Then
Risp = MsgBox(" Il minuto della rete è sbagliato!!! ", 69632, "Attenzione!!!")
Exit Sub
ElseIf TextBox4 = "" Then Worksheets(ComboBox4.Text).Cells(X + 4, ComboBox2.Value + 2) = ""
ElseIf TextBox5 = "" Then Worksheets(ComboBox4.Text).Cells(X + 5, ComboBox2.Value + 2) = ""
ElseIf TextBox4 < TextBox1 Or TextBox4 > TextBox2 Then
Risp = MsgBox(" Il minuto dell'ammonizione è sbagliato!!! ", 69632, "Attenzione!!!")
Exit Sub
ElseIf TextBox5 < TextBox1 Or TextBox5 > TextBox2 Then
Risp = MsgBox(" Il minuto dell'espulzione è sbagliato!!! ", 69632, "Attenzione!!!")
Exit Sub
End If
Worksheets(ComboBox4.Text).Cells(X, ComboBox2.Value + 2) = TextBox3.Value
If TextBox3.Value = 0 Then Worksheets(ComboBox4.Text).Cells(X, ComboBox2.Value + 2) = 0
Worksheets(ComboBox4.Text).Cells(X + 1, ComboBox2.Value + 2) = N
Worksheets(ComboBox4.Text).Cells(X + 2, ComboBox2.Value + 2) = TextBox1.Value
Worksheets(ComboBox4.Text).Cells(X + 3, ComboBox2.Value + 2) = TextBox2.Value
Worksheets(ComboBox4.Text).Cells(X + 4, ComboBox2.Value + 2) = TextBox4.Value
Worksheets(ComboBox4.Text).Cells(X + 5, ComboBox2.Value + 2) = TextBox5.Value
Worksheets(ComboBox4.Text).Cells(X + 7, 2) = ComboBox3.Value
If Worksheets(ComboBox4.Text).Cells(X + 1, ComboBox2.Value + 2) <> "" Then Worksheets(ComboBox4.Text).Cells(X + 6, ComboBox2.Value + 2) = "X"
End If
Next
TextBox1.Text = 0
TextBox2.Text = 90
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
ActiveSheet.Range("A:AP").Columns.AutoFit
End Sub
Private Sub CommandButton2_Click()
If ComboBox4.Text = "" Then Exit Sub
Worksheets(ComboBox4.Text).Range("A:AP").Columns.AutoFit
Range("A1").Select
Worksheets("Nomi").Activate
Unload Me
End Sub
Private Sub CommandButton3_Click()
Dim Pippo As Integer
If ComboBox4.Text = "" Then Exit Sub
For xx = 1 To 1000
If Worksheets(ComboBox4.Text).Cells(xx, 1) = ComboBox1.Value Then Exit For
Next
ComboBox3.Value = Worksheets(ComboBox4.Text).Cells(xx + 7, 2).Value
Pippo = Worksheets(ComboBox4.Text).Cells(xx + 6, 100).End(xlToLeft).Column
ComboBox2.Text = Worksheets(ComboBox4.Text).Cells(xx + 6, Pippo).End(xlToLeft).Column - 1
End Sub
Private Sub UserForm_Activate()
Dim A As String
Dim B As String
On Error Resume Next
A = Year(Now)
B = Right(A, 2) + 1
TextBox1.Text = 0
TextBox2.Text = 90
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
ComboBox1.Text = "2008/09" 'A & "/0" & B
ComboBox2.Text = 5
ComboBox3.Value = Worksheets(ComboBox4.Text).Cells(xx + 7, 2)
ComboBox3.RowSource = ("Dati!D1:D" & Fine)
ComboBox4.RowSource = ("NOMI!A2:A" & FineN)
End Sub
|