
Private Sub Cancella_Click()
'Claer the form
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
ctl.Value = ""
ElseIf TypeName(ctl) = "CheckBox" Then
ctl.Value = False
End If
Next ctl
End Sub
Private Sub Esci_Click()
Unload Me
End Sub
Private Sub OK_Click()
Dim ctl As Control
nome = Me.ComboBox1.Value
If Me.Materia.Value = "" Then
MsgBox "Per favore inserire un Corso.", vbExclamation, "Orario"
Me.Materia.SetFocus
Exit Sub
End If
Sheets(nome).Activate
RowCount = Worksheets(nome).Range("A1").CurrentRegion.Rows.Count
With Worksheets(nome).Range("A1")
.Offset(RowCount, 0).Value = Me.Materia.Value
.Offset(RowCount, 1).Value = Me.Docente.Value
.Offset(RowCount, 2).Value = Me.Lunedì.Value
.Offset(RowCount, 3).Value = Me.Martedì.Value
.Offset(RowCount, 4).Value = Me.Mercoledì.Value
.Offset(RowCount, 5).Value = Me.Giovedì.Value
.Offset(RowCount, 6).Value = Me.Venerdì.Value
.Offset(RowCount, 7).Value = Me.Dipartimento.Value
.Offset(RowCount, 8).Value = Me.Aula.Value
.Offset(RowCount, 9).Value = Me.TextBox1.Value
End With
End Sub
Private Sub primo_Click()
If ComboBox1.Name = ("Triennale 1° semestre") Then
End If
If ComboBox1.Name = ("Triennale 2° semestre") Then
End If
If ComboBox1.Name = ("Magistrale 1° semestre") Then
End If
If ComboBox1.Name = ("Magistrale 2° semestre") Then
End If
If primo.Value = True Then
secondo.Value = False
secondo.Enabled = False
terzo.Value = False
terzo.Enabled = False
Else
secondo.Enabled = True
End If
Exit Sub
End Sub
Private Sub secondo_Click()
If ComboBox1.Name = ("Triennale 1° semestre") Then
End If
If ComboBox1.Name = ("Triennale 2° semestre") Then
End If
If ComboBox1.Name = ("Magistrale 1° semestre") Then
End If
If ComboBox1.Name = ("Magistrale 2° semestre") Then
End If
If secondo.Value = True Then
primo.Value = False
primo.Enabled = False
terzo.Value = False
terzo.Enabled = False
Else
secondo.Enabled = True
End If
Exit Sub
End Sub
Private Sub terzo_Click()
If ComboBox1.Name = ("Triennale 1° semestre") Then
End If
If ComboBox1.Name = ("Triennale 2° semestre") Then
End If
If terzo.Value = True Then
secondo.Value = False
secondo.Enabled = False
primo.Value = False
primo.Enabled = False
Else
secondo.Enabled = True
End If
Exit Sub
If ComboBox1.Name = ("Triennale 1° semestre") Then
Exit Sub
End If
If ComboBox1.Name = ("Triennale 2° semestre") Then
Exit Sub
End If
If ComboBox1.Name = ("Magistrale 1° semestre") Then
Exit Sub
End If
If ComboBox1.Name = ("Magistrale 2° semestre") Then
Exit Sub
End If
If secondo.Value = True Then
primo.Value = False
primo.Enabled = False
terzo.Value = False
terzo.Enabled = False
'Else
'terzo.Enabled = True
End If
Exit Sub
End Sub
|
Private Sub OK_Click() Dim ctl As Control nome = Me.ComboBox1.Value If Me.Materia.Value = "" Then MsgBox "Per favore inserire un Corso.", vbExclamation, "Orario" Me.Materia.SetFocus Exit Sub End If Select Case True Case OptionButton1 anno = "anno1" Case OptionButton2 anno = "anno2" Case OptionButton3 anno = "anno3" End Select Sheets(nome).Activate RowCount = Worksheets(nome).Range(anno).CurrentRegion.Rows.Count With Worksheets(nome).Range(anno) .Offset(RowCount, 0).Value = Me.Materia.Value .Offset(RowCount, 1).Value = Me.Docente.Value .Offset(RowCount, 2).Value = Me.Lunedì.Value .Offset(RowCount, 3).Value = Me.Martedì.Value .Offset(RowCount, 4).Value = Me.Mercoledì.Value .Offset(RowCount, 5).Value = Me.Giovedì.Value .Offset(RowCount, 6).Value = Me.Venerdì.Value .Offset(RowCount, 7).Value = Me.Dipartimento.Value .Offset(RowCount, 8).Value = Me.Aula.Value .Offset(RowCount, 9).Value = Me.TextBox1.Value End With End Sub |
Private Sub Calendar1_Click() Label12.Caption = Format(Calendar1.Value, "dd/mm/yyyy") End Sub |
Private Sub Calendar1_Click() ComboBox4.Caption = Format(Calendar1.Value, "dd/mm/yyyy") End Sub |
nome = Me.ComboBox2 & Me.ComboBox3 |
Option Explicit 'UserForm with Frame1 Private WithEvents Calendar1 As cCalendar |
Option Explicit Private Sub OK_Click() Dim ctl As Control Dim anno As String Dim nome As String nome = Me.ComboBox2 & Me.ComboBox3 If Me.ComboBox1.Value = "" Then MsgBox "Per favore inserire un Corso.", vbExclamation, "Orario" Me.ComboBox1.SetFocus Exit Sub End If Select Case True Case OptionButton1 anno = "anno1" Case OptionButton2 anno = "anno2" Case OptionButton3 anno = "anno3" End Select Sheets(nome).Activate RowCount = Worksheets(nome).Range(anno).CurrentRegion.Rows.Count With Worksheets(nome).Range(anno) .Offset(RowCount, 0).Value = Me.ComboBox1.Value .Offset(RowCount, 1).Value = Me.TextBox1.Value .Offset(RowCount, 2).Value = Me.Lunedì.Value .Offset(RowCount, 3).Value = Me.Martedì.Value .Offset(RowCount, 4).Value = Me.Mercoledì.Value .Offset(RowCount, 5).Value = Me.Giovedì.Value .Offset(RowCount, 6).Value = Me.Venerdì.Value .Offset(RowCount, 7).Value = Me.ComboBox4.Value .Offset(RowCount, 8).Value = Me.ComboBox5.Value .Offset(RowCount, 9).Value = Me.TextBox3.Value End With End Sub |
Private Sub OK_Click() Dim ctl As Control Dim nome As String Dim anno As String Dim RowCount As Integer Private Sub OK_Click() Dim ctl As Control Dim anno As String Dim nome As String |
Private Sub CommandButton1_Click()
If ComboBox2.Value = "magistrale" And ComboBox3.Value = "primo" Then
Sheets("magistraleprimo").UsedRange.Select
riga = magistraleprimo.UsedRange.Rows.Count
For indi = 2 To riga
If Range("C" & indi) <> TxtCategoria.Text Then
Range("C" & indi).Select
Selection.EntireRow.Hidden = True
End If
Next
End Sub |
Private Sub CommandButton1_Click()
Dim ctl As Control
Dim rowcount As Integer
nome = Me.ComboBox2 & Me.ComboBox3
If ComboBox2.Value = "magistrale" And ComboBox3.Value = "primo" Then
Sheets(nome).UsedRange.Select
End If
With Sheets(nome)
Sheets(nome).Activate
With Worksheets(nome) '.Range(anno)
Me.Lunedì.Value = .Cells(, 4) '.Value 'rowcount, 3).Value
Me.Martedì.Value = .Cells(, 5) '(rowcount, 4).Value
Me.Mercoledì.Value = .Cells(, 6) '(rowcount, 5).Value
Me.Giovedì.Value = .Cells(, 7) '(rowcount, 6).Value
Me.Venerdì.Value = .Cells(, 8) '(rowcount, 7).Value
Me.ComboBox4.Value = .Cells(, 9) '(rowcount, 8).Value
Me.ComboBox5.Value = .Cells(, 10) '(rowcount, 9).Value
Me.TextBox3.Value = .Cells(, 11) '(rowcount, 10).Value
End With
End If
End With
End Sub
|
Private Sub CommandButton1_Click()
Dim nome As String
nome = Me.ComboBox2 & Me.ComboBox3
Dim lRiga As Long
Dim lng As Long
Sheets(nome).Activate
With Sheets(nome) '.Range(anno)
lRiga = .Range("A" & .Rows.Count).End(xlUp).Row
For lng = 2 To lRiga
If CStr(.Cells(lng, 0).Value) = Me.ComboBox1.Value Then
Me.Lunedì.Value = .Cells(lng, 4).Value
Me.Martedì.Value = .Cells(lng, 5).Value
Me.Mercoledì.Value = .Cells(lng, 6).Value
Me.Giovedì.Value = .Cells(lng, 7).Value
Me.Venerdì.Value = .Cells(lng, 8).Value
Me.ComboBox4.Value = .Cells(lng, 9).Value
Me.ComboBox5.Value = .Cells(lng, 10).Value
Me.TextBox3.Text = .Cells(lng, 11).Value
Exit For
End If
Next
End With
End Sub |
Private Sub CommandButton1_Click()
Dim nome As String
nome = Me.ComboBox2 & Me.ComboBox3
Dim lRiga As Long
Dim lng As Long
Sheets(nome).Activate
With Sheets(nome)
lRiga = .Range("A" & .Rows.Count).End(xlUp).Row
For lng = 2 To lRiga
If .Cells(lng, 1).Value = Me.ComboBox1.Value Then
Me.Lunedì.Value = .Cells(lng, 4).Value
Me.Martedì.Value = .Cells(lng, 5).Value
Me.Mercoledì.Value = .Cells(lng, 6).Value
Me.Giovedì.Value = .Cells(lng, 7).Value
Me.Venerdì.Value = .Cells(lng, 8).Value
Me.ComboBox4.Value = .Cells(lng, 9).Value
Me.ComboBox5.Value = .Cells(lng, 10).Value
Me.TextBox3.Text = .Cells(lng, 11).Value
Exit For
End If
Next
End With
End Sub
|
Dim c As Range
Dim rng As Range
With Sheets(nome)
Set rng = .Range("A1:A14" & Cells(Rows.Count, "N").End(xlUp).Row)
For Each c In rng
If c.Value = ComboBox1.Value Then
OptionButton1 = True
End If
Next
End With
With Sheets(nome)
Set rng = .Range("A17:A23" & Cells(Rows.Count, "N").End(xlUp).Row)
For Each c In rng
If c.Value = ComboBox1.Value Then
OptionButton2 = True
End If
Next
End With
With Sheets(nome)
Set rng = .Range("A26:A35" & Cells(Rows.Count, "N").End(xlUp).Row)
For Each c In rng
If c.Value = ComboBox1.Value Then
OptionButton3 = True
End If
Next
End With |
'CONTROLLO SE IL CORSO E' STATO GIA' ARCHIVIATO
With Sheets(nome)
Set rng = .Range("A1:A35" & Cells(Rows.Count, "N").End(xlUp).Row)
'Set c = ComboBox1.Value
For Each c In rng
If c.Value = "" Then
MsgBox "Il Corso non è presente in archivio", 16, "Avviso"
Me.OptionButton3.SetFocus
Exit Sub |
Private Sub ComboBox2_AfterUpdate()
'Me.ComboBox2.Clear
Sheets("Foglio1").Activate
If ComboBox2.Value = "Magistrale" Then
ComboBox6.RowSource = Foglio1.Range("v2:v3").Address
End If
If ComboBox2.Value = "Magistrale" And ComboBox6.Value = "Primo" And ComboBox3.Value = "Primo" Then ComboBox1.RowSource = Foglio1.Range("g2:g12").Address
If ComboBox2.Value = "Magistrale" And ComboBox6.Value = "Primo" And ComboBox3.Value = "Secondo" Then ComboBox3.RowSource = Foglio1.Range("g16:g25").Address
If ComboBox2.Value = "Magistrale" And ComboBox6.Value = "Secondo" And ComboBox3.Value = "Primo" Then ComboBox1.RowSource = Foglio1.Range("h2:h5").Address
If ComboBox2.Value = "Magistrale" And ComboBox6.Value = "Secondo" And ComboBox3.Value = "Secondo" Then ComboBox3.RowSource = Foglio1.Range("h8:h16").Address
If ComboBox2.Value = "Triennale" Then
ComboBox6.RowSource = Foglio1.Range("v2:v4").Address
End If
If ComboBox2.Value = "Triennale" And ComboBox6.Value = "Primo" And ComboBox3.Value = "Primo" Then ComboBox1.RowSource = Foglio1.Range("i2:i6").Address
If ComboBox2.Value = "Triennale" And ComboBox6.Value = "Primo" And ComboBox3.Value = "Secondo" Then ComboBox1.RowSource = Foglio1.Range("j2:j6").Address
If ComboBox2.Value = "Triennale" And ComboBox6.Value = "Secondo" And ComboBox3.Value = "Primo" Then ComboBox1.RowSource = Foglio1.Range("i8:i12").Address
If ComboBox2.Value = "Triennale" And ComboBox6.Value = "Secondo" And ComboBox3.Value = "Secondo" Then ComboBox1.RowSource = Foglio1.Range("j8:j11").Address
If ComboBox2.Value = "Triennale" And ComboBox6.Value = "Terzo" And ComboBox3.Value = "Primo" Then ComboBox1.RowSource = Foglio1.Range("i14:i16").Address
If ComboBox2.Value = "Triennale" And ComboBox6.Value = "Terzo" And ComboBox3.Value = "Secondo" Then ComboBox1.RowSource = Foglio1.Range("j14:j17").Address
End Sub |
Private Sub ListView1_Click()
Dim laurea As String
Dim semestre As String
Dim lista As Long
Dim anno As String
laurea = "Triennale"
semestre = "Primo"
anno = "anno1"
ComboBox1.Text = ListView1.SelectedItem
ComboBox2 = laurea
ComboBox3 = semestre
ComboBox6 = anno
Me.Lunedì = ListView1.SelectedItem.SubItems(2)
Me.Martedì = ListView1.SelectedItem.SubItems(3)
Me.Mercoledì = ListView1.SelectedItem.SubItems(4)
Me.Giovedì = ListView1.SelectedItem.SubItems(5)
Me.Venerdì = ListView1.SelectedItem.SubItems(6)
Me.ComboBox4 = ListView1.SelectedItem.SubItems(7)
Me.ComboBox5 = ListView1.SelectedItem.SubItems(8)
Me.TextBox3 = ListView1.SelectedItem.SubItems(9)
'Me.ComboBox5 = ListView1.SelectedItem.SubItems(10)
'TextBox3 = ListView1.SelectedItem.SubItems(11)
End Sub |
Private Sub CommandButton1_Click()
Dim indice As Integer
indice = Me.ListView1.SelectedItem.Index + 1
nome = ComboBox2 & ComboBox3
With Sheets(nome)
.Cells(indice, 0).Value = Me.ComboBox1.Value
'.Cells(indice, 2).Value = ComboBox2
'.Cells(indice, 3).Value = ComboBox3
.Cells(indice, 1).Value = Me.TextBox1.Value
.Cells(indice, 2).Value = Me.Lunedì.Value
.Cells(indice, 3).Value = Me.Martedì.Value
.Cells(indice, 4).Value = Me.Mercoledì.Value
.Cells(indice, 5).Value = Me.Giovedì.Value
.Cells(indice, 6).Value = Me.Venerdì.Value
.Cells(indice, 7).Value = Me.ComboBox4.Value
.Cells(indice, 8).Value = Me.ComboBox5.Value
'.Cells(indice, 9).Value = TextBox3.Value
End With
Call ricalcola
End Sub
|
.Cells(indice, 0).Value = Me.ComboBox1.Value |
Private Sub CommandButton9_Click()
Dim indice As Integer
indice = Me.ListView9.SelectedItem.Index + 2
nome = ComboBox2 & ComboBox3
With Sheets(nome) |
Private Sub CommandButton1_Click()
Dim indice As Integer
indice = Me.ListView1.SelectedItem.Index '+ 2
nome = ComboBox2 & ComboBox3
With Sheets(nome)
.Cells(indice, 1).Value = Me.ComboBox1.Value
.Cells(indice, 2).Value = Me.TextBox1.Value
.Cells(indice, 3).Value = Me.Lunedì.Value
.Cells(indice, 4).Value = Me.Martedì.Value
.Cells(indice, 5).Value = Me.Mercoledì.Value
.Cells(indice, 6).Value = Me.Giovedì.Value
.Cells(indice, 7).Value = Me.Venerdì.Value
.Cells(indice, 8).Value = Me.ComboBox4.Value
.Cells(indice, 9).Value = Me.ComboBox5.Value
.Cells(indice, 10).Value = TextBox3.Value
End With
Call ricalcola
End Sub
Private Sub ListView1_Click()
Dim laurea As String
Dim semestre As String
Dim lista As Long
Dim anno As String
laurea = "Triennale"
semestre = "Primo"
anno = "I"
ComboBox1.Text = ListView1.SelectedItem
ComboBox2 = laurea
ComboBox3 = semestre
ComboBox6 = anno
Me.Lunedì = ListView1.SelectedItem.SubItems(2)
Me.Martedì = ListView1.SelectedItem.SubItems(3)
Me.Mercoledì = ListView1.SelectedItem.SubItems(4)
Me.Giovedì = ListView1.SelectedItem.SubItems(5)
Me.Venerdì = ListView1.SelectedItem.SubItems(6)
Me.ComboBox4 = ListView1.SelectedItem.SubItems(7)
Me.ComboBox5 = ListView1.SelectedItem.SubItems(8)
TextBox3 = ListView1.SelectedItem.SubItems(9)
'Me.TextBox1 = ListView1.SelectedItem.SubItems(10)
'Me.TextBox2 = ListView1.SelectedItem.SubItems(11)
End Sub
Private Sub UserForm_Initialize()
Dim Lv As Object
Dim conta_riga As Integer
Dim riga As Integer
Set sh = ThisWorkbook.Worksheets("Foglio1")
With sh
lRiga = .Range("A" & .Rows.Count).End(xlUp).Row
Me.ComboBox1.RowSource = .Name & "!A2:A" & lRiga
End With
Sheets("TriennalePrimo").Select
conta_riga = Sheets("TriennalePrimo").Range("A" & Rows.Count).End(xlUp).Row
Me.ListView1.ListItems.Clear
For riga = 3 To conta_riga
Set Lv = ListView1.ListItems.Add(Text:=Sheets("TriennalePrimo").Cells(riga, 1))
Lv.ListSubItems.Add Text:=Sheets("TriennalePrimo").Cells(riga, 1)
Lv.ListSubItems.Add Text:=Sheets("TriennalePrimo").Cells(riga, 2)
Lv.ListSubItems.Add Text:=Sheets("TriennalePrimo").Cells(riga, 3)
Lv.ListSubItems.Add Text:=Sheets("TriennalePrimo").Cells(riga, 4)
Lv.ListSubItems.Add Text:=Sheets("TriennalePrimo").Cells(riga, 5)
Lv.ListSubItems.Add Text:=Sheets("TriennalePrimo").Cells(riga, 6)
Lv.ListSubItems.Add Text:=Sheets("TriennalePrimo").Cells(riga, 7)
Lv.ListSubItems.Add Text:=Sheets("TriennalePrimo").Cells(riga, 9)
Lv.ListSubItems.Add Text:=Sheets("TriennalePrimo").Cells(riga, 10)
Next riga
With ListView1
.Enabled = True
.HideColumnHeaders = False
.Appearance = ccFlat
.Gridlines = True
.View = lvwReport
.FullRowSelect = True
'.RowSource = "TriennalePrimo!A3:A14"
.ColumnHeaders.Add Text:="Materia", Width:=50, Alignment:=0
.ColumnHeaders.Add Text:="Docente", Width:=50, Alignment:=0
.ColumnHeaders.Add Text:="Lun", Width:=50, Alignment:=0
.ColumnHeaders.Add Text:="Mar", Width:=50, Alignment:=0
.ColumnHeaders.Add Text:="Mer", Width:=50, Alignment:=0
.ColumnHeaders.Add Text:="Gio", Width:=50, Alignment:=0
.ColumnHeaders.Add Text:="Ven", Width:=50, Alignment:=0
.ColumnHeaders.Add Text:=Me.ComboBox4.Value, Width:=50, Alignment:=0
.ColumnHeaders.Add Text:=Me.ComboBox5.Value, Width:=50, Alignment:=0
.ColumnHeaders.Add Text:="Data Inzio", Width:=100, Alignment:=0
.MultiSelect = fmMultiSelectSingle
End With
Public Sub ricalcola()
Dim conta_riga As Integer
Dim riga As Integer
Dim Lv As Object
nome = ComboBox2 & ComboBox3
Sheets(nome).Select
conta_riga = Sheets(nome).Range("A" & Rows.Count).End(xlUp).Row
Me.ListView1.ListItems.Clear
For riga = 3 To conta_riga
Set Lv = ListView1.ListItems.Add(Text:=Sheets(nome).Cells(riga, 1))
Lv.ListSubItems.Add Text:=Sheets(nome).Cells(riga, 2)
Lv.ListSubItems.Add Text:=Sheets(nome).Cells(riga, 3)
Lv.ListSubItems.Add Text:=Sheets(nome).Cells(riga, 4)
Lv.ListSubItems.Add Text:=Sheets(nome).Cells(riga, 5)
Lv.ListSubItems.Add Text:=Sheets(nome).Cells(riga, 6)
Lv.ListSubItems.Add Text:=Sheets(nome).Cells(riga, 7)
Lv.ListSubItems.Add Text:=Sheets(nome).Cells(riga, 8)
Lv.ListSubItems.Add Text:=Sheets(nome).Cells(riga, 9)
Lv.ListSubItems.Add Text:=Sheets(nome).Cells(riga, 10)
Next riga
|
Option Explicit
Dim nome As String
Dim rng As Range
Private Sub Worksheet_nome_Activate()
nome = ComboBox2 & ComboBox3
Call m
End Sub
Private Sub m()
Set rng = Me.Range("A3").CurrentRegion
With Me.ListView1
.ColumnCount = rng.Columns.Count
.Clear
.List = rng.Value
End With
End Sub
Public Sub Elimina()
rng.Rows(ListView1.ListIndex + 1).EntireRow.Delete
Call m
End Sub
Private Sub CommandButton12_Click() 'Listview1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim lRisposta As Long
lRisposta = MsgBox("Eliminare la riga?", vbYesNo + vbQuestion, "Attenzione!")
If lRisposta = vbYes Then
Call Elimina
End If
End Sub
Public Sub Carica()
Call m
End Sub
|
