
Private Sub cmdGeneraGrafico_Click()
Dim strColonnaB As String
Dim strColonnaC As String
Dim strColonnaD As String
Dim strColonnaE As String
Dim strColonnaF As String
Dim strColonnaG As String
Dim strColonnaH As String
Dim strColonnaI As String
Dim strColonnaJ As String
Dim strFoglio As String
Dim i As Integer
Dim intNumeroRighe As Integer
Dim strAutoH As Integer
Dim strIntervallo As Integer
strFoglio = ActiveSheet.Name
For i = 2 To 35
If Range("A" & i) = "" Then intNumeroRighe = i - 2
Exit For
End
Next
If ChkAlimentari.Value = True Then strColonnaB = "B1 : B" & intNumeroRighe & ","
End
If ChkAbbigliamento.Value = True Then strColonnaC = "C1 : C" & intNumeroRighe & ","
End
If ChkSvago.Value = True Then strColonnaD = "D1 : D" & intNumeroRighe & ","
End
If ChkLibri.Value = True Then strColonnaE = "E1 : E" & intNumeroRighe & ","
End
If ChkViaggi.Value = True Then strColonnaF = "F1 : F" & intNumeroRighe & ","
End
If ChkCasa.Value = True Then strColonnaG = "G1 : G" & intNumeroRighe & ","
End
If ChkAuto.Value = True Then strAutoH = "H1 : H" & intNumeroRighe & ","
End
If ChkVarie.Value = True Then strColonnaI = "I1 : I" & intNumeroRighe & ","
End
If ChkTotali.Value = True Then strColonnaJ = "J1 : J" & intNumeroRighe & ","
End
strIntervallo = "A1:A" & intNumeroRighe & "," & strColonnaB & strColonnaC & strColonnaD & _
strColonnaE & strColonnaF & strColonnaG & strColonnaH & strColonnaI & strColonnaJ
strIntervallo = Left(strIntervallo, Len(strIntervallo) - 1)
Range(strIntervallo).Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.Location Where:=xlLocationAsObject, Name:=strFoglio
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Spese" & strFoglio
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.FontStyle = "Normale"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End Sub |
Private Sub cmdGeneraGrafico_Click()
Dim strColonnaB As String
Dim strColonnaC As String
Dim strColonnaD As String
Dim strColonnaE As String
Dim strColonnaF As String
Dim strColonnaG As String
Dim strColonnaH As String
Dim strColonnaI As String
Dim strColonnaJ As String
Dim strFoglio As String
Dim i As Integer
Dim intNumeroRighe As Integer
Dim strAutoH As Integer
Dim strIntervallo As Integer
strFoglio = ActiveSheet.Name
For i = 2 To 35
If Range("A" & i) = "" Then intNumeroRighe = i - 2
Exit For
Next
If ChkAlimentari.Value = True Then strColonnaB = "B1 : B" & intNumeroRighe & ","
If ChkAbbigliamento.Value = True Then strColonnaC = "C1 : C" & intNumeroRighe & ","
If ChkSvago.Value = True Then strColonnaD = "D1 : D" & intNumeroRighe & ","
If ChkLibri.Value = True Then strColonnaE = "E1 : E" & intNumeroRighe & ","
If ChkViaggi.Value = True Then strColonnaF = "F1 : F" & intNumeroRighe & ","
If ChkCasa.Value = True Then strColonnaG = "G1 : G" & intNumeroRighe & ","
If ChkAuto.Value = True Then strAutoH = "H1 : H" & intNumeroRighe & ","
If ChkVarie.Value = True Then strColonnaI = "I1 : I" & intNumeroRighe & ","
If ChkTotali.Value = True Then strColonnaJ = "J1 : J" & intNumeroRighe & ","
strIntervallo = "A1:A" & intNumeroRighe & "," & _
strColonnaB & strColonnaC & strColonnaD & _
strColonnaE & strColonnaF & _
strColonnaG & strColonnaH & _
strColonnaI & strColonnaJ
strIntervallo = Left(strIntervallo, Len(strIntervallo) - 1)
Range(strIntervallo).Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.Location Where:=xlLocationAsObject, Name:=strFoglio
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Spese" & strFoglio
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.FontStyle = "Normale"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End Sub |
For i = 2 To 35
If Range("A" & i) = "" Then
intNumeroRighe = i - 2
Exit For
End If
Next
intNumeroRighe = intNumeroRighe + 1 |
