Sub Auto_Open() ' InstallToolbarReflets End Sub ' ' Créé le 02/09/2002 par Andrei Boyanov ' Repris le 05/09/2002 par Jean Christophe André ' Sub InstallToolbarReflets() If (is_bar_installed("Reflets") = False) Then Set barReflets = CommandBars.Add(name:="Reflets", Position:=msoBarTop) Set buttonReflets1 = barReflets.Controls.Add(Type:=msoControlButton) Set buttonReflets2 = barReflets.Controls.Add(Type:=msoControlButton) buttonReflets1.Caption = "CODA-Détails" buttonReflets1.DescriptionText = "Collage d'une interro-détails CODA à partir de TSE" buttonReflets1.Style = msoButtonCaption buttonReflets1.OnAction = "CODA_DETAILS" buttonReflets2.Caption = "CODA-Cumuls" buttonReflets2.DescriptionText = "Collage d'une interro-cumuls CODA à partir de TSE" buttonReflets2.Style = msoButtonCaption buttonReflets2.OnAction = "CODA_CUMULS" barReflets.Visible = True End If ' MsgBox ("Installation avec succès") End Sub Function is_bar_installed(name As Variant) For Each bar In CommandBars If (bar.name = name) Then is_bar_installed = True Exit Function End If Next is_bar_installed = False Exit Function End Function Function is_sheet_installed(name As Variant) For Each ws In Worksheets If (ws.name = name) Then is_sheet_installed = True Exit Function End If Next is_sheet_installed = False Exit Function End Function ' ' Créé le 02/09/2002 par Andrei Boyanov ' Sub RemoveToolbarReflets() ' MsgBox "Je vais supprimer le bouton et la barre d'outils Reflets" CommandBars("Reflets").Delete End Sub ' ' Créé le ??/08/2002 par CODA ? Van-Thong Souy ? ' Sub CODA_DETAILS() Dim w As Worksheet Dim r As Range Dim MaVariable As String Dim i As Integer Dim j As Integer ' changements par JCA ' Set w = Worksheets(ActiveWorkbook.ActiveSheet.name) If (is_sheet_installed("CODA-Détails") = False) Then Set w = Worksheets.Add w.name = "CODA-Détails" Else Set w = Worksheets("CODA-Détails") End If w.Paste Destination:=w.Range("A1:AT60000") Set r = w.Range("A2:AT60000") ' fin des changements par JCA i = 1 While Not i = 60001 j = 1 While Not j = 46 If j = 1 Then ' test des 5 premières colonnes If IsEmpty(r.Cells(i, 1)) And IsEmpty(r.Cells(i, 2)) And IsEmpty(r.Cells(i, 3)) And IsEmpty(r.Cells(i, 4)) And IsEmpty(r.Cells(i, 5)) Then Exit Sub End If End If If Not IsEmpty(r.Cells(i, j)) Then ' recuperation de la valeur et modification MaVariable = (r.Cells(i, j).Text) ' affichage du 'nombre' créé (on force avec une multiplication par 1) r.Cells(i, j).Select If Selection.NumberFormat = "General" And IsNumeric(MaVariable) Then If Not MaVariable = "#DEV!" Then If Not Selection.NumberFormat = "m/d/yy" Or Not Selection.NumberFormat = "hh:mm:ss" Then r.Cells(i, j).Replace What:=",", Replacement:=",", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False ActiveCell.FormulaR1C1 = MaVariable * 1 End If End If End If If Selection.NumberFormat = "General" Then If InStr(1, r.Cells(i, j).Text, ".") Then If InStr(1, r.Cells(i, j).Text, ",") Then If Not InStr(1, r.Cells(i, j).Text, "-") Then r.Cells(i, j).Replace What:=".", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False r.Cells(i, j).Select If IsNumeric(r.Cells(i, j).Text) Then ActiveCell.FormulaR1C1 = r.Cells(i, j).Text * 1 End If End If End If End If End If End If j = j + 1 Wend i = i + 1 Wend End Sub ' ' Créé le ??/08/2002 par CODA ? Van ? ' Sub CODA_CUMULS() Dim w As Worksheet Dim r As Range Dim MaVariable As String Dim i As Integer Dim j As Integer ' changements par JCA ' Set w = Worksheets(ActiveWorkbook.ActiveSheet.name) If (is_sheet_installed("CODA-Cumuls") = False) Then Set w = Worksheets.Add w.name = "CODA-Cumuls" Else Set w = Worksheets("CODA-Cumuls") End If w.Paste Destination:=w.Range("A1:J60000") Set r = w.Range("B1:J60000") ' fin des changements par JCA i = 1 While Not i = 60001 j = 1 While Not j = 10 If Not IsEmpty(r.Cells(i, j)) Then ' recuperation de la valeur et modification MaVariable = Trim(r.Cells(i, j).Text) ' affichage du 'nombre' créé (on force avec une multiplication par 1) r.Cells(i, j).Select If IsNumeric(r.Cells(i, j).Text) Then ActiveCell.FormulaR1C1 = MaVariable * 1 End If Else If j = 1 Then Cells.Select Range("A23").Activate Selection.Columns.AutoFit Exit Sub End If End If j = j + 1 Wend i = i + 1 Wend Cells.Select Range("A23").Activate Selection.Columns.AutoFit End Sub