Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
Private Sub Cancella_Click()
Dim targa As String
Dim i As Integer
targa = Cells(11, "D").Value
If ((targa = "") Or (IsEmpty(Cells(11, "D").Value))) Then Exit Sub
i = 1
Do While ((Not IsEmpty(Sheets("Elenco").Cells(i, "C").Value)) And (VBA.UCase(Sheets("Elenco").Cells(i, "C").Value) <> VBA.UCase(targa)))
i = i + 1
Loop
Dim answer As Integer
answer = MsgBox("Sei sicuro di voler eliminare il veicolo targato '" + targa + "'?", vbYesNo + vbQuestion, "Elimina")
If answer = vbYes Then
Sheets("Elenco").Rows(i).Delete
Cells(9, "D").Value = ""
Cells(10, "D").Value = ""
Cells(11, "D").Value = ""
Cells(12, "D").Value = ""
Cells(15, "E").Value = ""
Cells(17, "E").Value = ""
Cells(18, "E").Value = ""
Cells(19, "E").Value = ""
Cells(20, "E").Value = ""
Cells(21, "E").Value = ""
Cells(30, "E").Value = ""
Cells(31, "E").Value = ""
Cells(32, "E").Value = ""
Cells(34, "E").Value = ""
End If
End Sub
Private Sub Cerca_Click()
Dim targa As String
targa = Cells(11, "D").Value
If ((targa = "") Or (IsEmpty(Cells(11, "D").Value))) Then Exit Sub
Dim i As Integer
i = 1
Do While ((Not IsEmpty(Sheets("Elenco").Cells(i, "C").Value)) And (VBA.UCase(Sheets("Elenco").Cells(i, "C").Value) <> VBA.UCase(targa)))
i = i + 1
Loop
If Not IsEmpty(Sheets("Elenco").Cells(i, "C").Value) Then
Cells(9, "D").Value = Sheets("Elenco").Cells(i, "A").Value
Cells(10, "D").Value = Sheets("Elenco").Cells(i, "B").Value
Cells(11, "D").Value = Sheets("Elenco").Cells(i, "C").Value
Cells(12, "D").Value = Sheets("Elenco").Cells(i, "D").Value
Cells(15, "E").Value = Sheets("Elenco").Cells(i, "E").Value
Cells(17, "E").Value = Sheets("Elenco").Cells(i, "F").Value
Cells(18, "E").Value = Sheets("Elenco").Cells(i, "G").Value
Cells(19, "E").Value = Sheets("Elenco").Cells(i, "H").Value
Cells(20, "E").Value = Sheets("Elenco").Cells(i, "I").Value
Cells(21, "E").Value = Sheets("Elenco").Cells(i, "J").Value
Cells(30, "E").Value = Sheets("Elenco").Cells(i, "P").Value
Cells(31, "E").Value = Sheets("Elenco").Cells(i, "Q").Value
Cells(32, "E").Value = Sheets("Elenco").Cells(i, "R").Value
Cells(34, "E").Value = Sheets("Elenco").Cells(i, "S").Value
Sheets("Redditività Usato").ComboBox1.Value = Sheets("Elenco").Cells(i, "T").Value
Else
MsgBox "Impossibile trovare la targa richiesta"
End If
End Sub
Private Sub Salva_Click()
Dim targa As String
Dim i As Integer
targa = Cells(11, "D").Value
If ((targa = "") Or (IsEmpty(Cells(11, "D").Value))) Then Exit Sub
i = 1
Do While ((Not IsEmpty(Sheets("Elenco").Cells(i, "C").Value)) And (VBA.UCase(Sheets("Elenco").Cells(i, "C").Value) <> VBA.UCase(targa)))
i = i + 1
Loop
If Not IsEmpty(Sheets("Elenco").Cells(i, "C").Value) Then
Dim answer As Integer
answer = MsgBox("Sovrascrivere i dati del veicolo targato '" + targa + "'?", vbYesNo + vbQuestion, "Salva")
If answer = vbNo Then Exit Sub
End If
Sheets("Elenco").Cells(i, "A").Value = Cells(9, "D").Value
Sheets("Elenco").Cells(i, "B").Value = Cells(10, "D").Value
Sheets("Elenco").Cells(i, "C").Value = Cells(11, "D").Value
Sheets("Elenco").Cells(i, "D").Value = Cells(12, "D").Value
Sheets("Elenco").Cells(i, "E").Value = Cells(15, "E").Value
Sheets("Elenco").Cells(i, "F").Value = Cells(17, "E").Value
Sheets("Elenco").Cells(i, "G").Value = Cells(18, "E").Value
Sheets("Elenco").Cells(i, "H").Value = Cells(19, "E").Value
Sheets("Elenco").Cells(i, "I").Value = Cells(20, "E").Value
Sheets("Elenco").Cells(i, "J").Value = Cells(21, "E").Value
Sheets("Elenco").Cells(i, "K").Formula = "=G" & i & "+H" & i & "+I" & i & "+J" & i
Sheets("Elenco").Cells(i, "L").Formula = "=F" & i & "+K" & i
Sheets("Elenco").Cells(i, "M").Formula = "=K" & i & "/F" & i
Sheets("Elenco").Cells(i, "N").Formula = "=K" & i & "/E" & i
Sheets("Elenco").Cells(i, "O").Formula = "=E" & i & "-(L" & i & "+P" & i & "+Q" & i & "+R" & i & "+S" & i & ")"
Sheets("Elenco").Cells(i, "U").Value = Date
Sheets("Elenco").Cells(i, "P").Value = Cells(30, "E").Value
Sheets("Elenco").Cells(i, "Q").Value = Cells(31, "E").Value
Sheets("Elenco").Cells(i, "R").Value = Cells(32, "E").Value
Sheets("Elenco").Cells(i, "S").Value = Cells(34, "E").Value
Sheets("Elenco").Cells(i, "A").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "B").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "C").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "D").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "E").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "F").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "G").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "H").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "I").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "J").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "K").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "L").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "M").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "N").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "O").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "P").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "Q").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "R").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "S").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "T").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "U").Borders.LineStyle = xlContinuous
Sheets("Elenco").Cells(i, "T").Value = Sheets("Redditività Usato").ComboBox1.Value
End Sub
Private Sub Worksheet_Activate()
Dim i As Integer
i = 2
Sheets("Redditività Usato").ComboBox1.Clear
Do While ((Not IsEmpty(Sheets("Venditori").Cells(i, "A").Value)))
Sheets("Redditività Usato").ComboBox1.AddItem Sheets("Venditori").Cells(i, "A").Value
i = i + 1
Loop
Sheets("Redditività Usato").ComboBox1.ListIndex = 0
End Sub