Sinon voila comment ca marche, j ai cree une barre d outil personnelle avec une icone qui quand je clique dessus lance cette macro
Private Sub veriftdc()
checkTDC.Show
End Sub
donc cette macro lance une userform chektdc, avec en texte quelques recommendation et deux bouton un pour lancer la macro TDC (qui est une macro qui fait des tableau croise dynamique de maniere assite) donc dans cette userform j ai ca
Private Sub Run_Click()
Call TDC
End Sub
Private Sub closee_Click()
Unload checkTDC
End Sub
Private Sub Label1_Click()
' Copy the sheet(1)
ThisWorkbook.Sheets(1).Copy
' Send Email
With ActiveWorkbook
.SendMail Recipients:=Array("j.######@live.fr")
.Close SaveChanges:=False
End With
tout marche sauf que le bouton Run ne veut veut pas appeller la macro TDC dont je te met le code
Sub TDC()
Dim Num_col As Integer, Num_col2 As Integer, Num_col3 As Integer, Num_col4 As Integer, diff As Integer
Set range1 = Application.InputBox("Select the title of the first variable !", "Sélection de cellules", Type:=8)
Set Range3 = Application.InputBox("Select the title of the second variable !", "Sélection de cellules", Type:=8)
Num_col = range1.Column
Set range2 = Application.InputBox("Select the first column to the right of the table touches the table !", "Sélection de cellules", Type:=8)
Num_col2 = range2.Column
diff = -(Num_col2 - Num_col)
Lettre_col = Left(range2.Address(0, 0), (range2.Column < 27) + 2)
Set Num_ligne = Application.InputBox("Select the square tdc !", "Sélection de cellules", Type:=8)
Num_ligne = Num_ligne.Row
With Range(Lettre_col & "1")
.FormulaR1C1 = "=RC[" & diff & "]"
.AutoFill Destination:=Range(Lettre_col & "1 :" & Lettre_col & "10000")
End With
Num_col3 = Range3.Column
diff = -((Num_col2 + 1) - Num_col3)
Lettre_col = Left(range2.Offset(0, 1).Address(0, 0), (range2.Offset(0, 1).Column < 27) + 2)
With Range(Lettre_col & "1")
.FormulaR1C1 = "=RC[" & diff & "]"
.AutoFill Destination:=Range(Lettre_col & "1 :" & Lettre_col & "10000")
End With
Num_col3 = Num_col2 + 1
Num_col4 = Num_col3 + 2
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Sheet1!R1C" & Num_col2 & ":R6000C" & Num_col3).CreatePivotTable TableDestination:="Sheet1!R" & Num_ligne & "C" & Num_col4, TableName:="Tableau croisé dynamique1", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTables("Tableau croisé dynamique1").AddFields RowFields:=Range3, ColumnFields:=range1
With ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotFields(CStr(range1))
.Orientation = xlDataField
.Function = xlCount
End With
ActiveWorkbook.ShowPivotTableFieldList = True
ActiveWorkbook.ShowPivotTableFieldList = False
Columns(Lettre_col).ClearContents
Lettre_col = range2.Column
Columns(Lettre_col).ClearContents
End Sub
le tout etant dans VbaProject(PERSONAL.XLS)