Ho una strano problema a cui non so dare risposta, infatti come vedete al termine di queste "Private Sub" (legate nei primi due casi a semplici eventi "Click" e nell'ultimo caso "Terminate") ho inserito delle piccole macro che dovrebbero aggiornare una tabella pivot nel foglio Contatti, ma così avviene solo nel primo caso, mi sapreste dire cosa mi sfugge?
- Codice: Seleziona tutto
Private Sub Fine_Click()
Linea = ActiveCell.Row
Cells(Linea, 5) = Indirizzo
Cells(Linea, 6) = CodAGESCI
Cells(Linea, 1) = StrConv(Cognomeplus, vbProperCase)
Cells(Linea, 2) = StrConv(Nomeplus, vbProperCase)
If Comune & " " & "(" & Provincia & ")" = " ()" Then
Else
Cells(Linea, 7) = Comune & " " & "(" & Provincia & ")"
End If
Cells(Linea, 8) = CAP
Cells(Linea, 9) = Telefono1
Cells(Linea, 10) = Telefono2
Cells(Linea, 11) = Telefono3
Cells(Linea, 12) = Mail1
Cells(Linea, 13) = Mail2
If Lupo_della = "Legge" Then
Cells(Linea, 16) = "L.d.L."
Else
If Lupo_della = "Rupe" Then
Cells(Linea, 16) = "L.d.R."
Else
If Lupo_della = "Anziano" Then
Cells(Linea, 16) = "zL.A."
Cells(Linea, 16).Activate
With ActiveCell.Characters(Start:=1, Length:=0).Font
.Name = "Calibri"
.FontStyle = "Grassetto"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16777216
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
With ActiveCell.Characters(Start:=1, Length:=1).Font
.Name = "Calibri"
.FontStyle = "Grassetto"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16727809
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
With ActiveCell.Characters(Start:=2, Length:=4).Font
.Name = "Calibri"
.FontStyle = "Grassetto"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16777216
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
Else
Cells(Linea, 16) = Lupo_della
End If
End If
End If
Cells(Linea, 20) = N°specialità
Cells(Linea, 39) = Anno_di_ingresso
Cells(Linea, 14) = Sestiglia
Cells(Linea, 15) = Ruolo_in_sestiglia
Cells(Linea, 3) = Data_di_nascita
Cells(Linea, 4) = Luogo_di_nascita
Inserimento_dati.Hide
If CheckBox1.Value = True Then
Application.Run "Aggiornamento"
End If
'Sheets(Dati_completi).Cells(Linea, 1).Activate
Sheets("Contatti").Activate
Sheets("Contatti").PivotTables("Tabella_pivot5").PivotCache.Refresh
Application.ScreenUpdating = True
End Sub
--------------------------------------------------------------------------------------------------
Private Sub Annulla_Click()
Inserimento_dati.Hide
Sheets("Contatti").Activate
Sheets("Contatti").PivotTables("Tabella_pivot5").PivotCache.Refresh
Application.ScreenUpdating = True
End Sub
----------------------------------------------------------------------------------------------
Private Sub Inserimento_dati_Terminate()
Sheets("Contatti").Activate
Sheets("Contatti").PivotTables("Tabella_pivot5").PivotCache.Refresh
Application.ScreenUpdating = True
End Sub