maccro VBA - VB/VBA/VBS - Programmation
Marsh Posté le 24-04-2012 à 12:27:47
Le mieux pour le VBA c'est de prendre un stagiaire ou alors de la main d'oeuvre étrangère.
Marsh Posté le 24-04-2012 à 12:31:32
Ce sujet a été déplacé de la catégorie Discussions vers la categorie Programmation par Ernestor
Marsh Posté le 20-05-2012 à 16:21:10
bonjour j'ai une macro qui consiste à faire des copies (onglets,données...)
son exécution m'affiche une erreur de compilation que j'arrive pas à déceler.merci de m'apporter aide.
cdlt
Sub controle_coherence()
'
' controle_coherence Macro
'
'
Sheets("récap tables" ).Select
Sheets("récap tables" ).Move
Columns("B:B" ).Select
Range("B2" ).Activate
Selection.Delete Shift:=xlToLeft
Range("F18" ).Select
Windows("base.xlsx" ).Activate
Windows("Classeur12" ).Activate
Range("C1" ).Select
ActiveCell.FormulaR1C1 = "Requete à exécuter sur Teradata"
Range("D1" ).Select
ActiveCell.FormulaR1C1 = "Objets1"
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Arial"
.FontStyle = "Gras"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("D:D" ).Select
Selection.Copy
Range("E1" ).Select
ActiveSheet.Paste
Range("F1" ).Select
ActiveSheet.Paste
Range("G1" ).Select
ActiveSheet.Paste
Range("E1" ).Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Objets2"
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Arial"
.FontStyle = "Gras"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("F1" ).Select
ActiveCell.FormulaR1C1 = "Objets3"
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Arial"
.FontStyle = "Gras"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("G1" ).Select
ActiveCell.FormulaR1C1 = "Objets4"
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Arial"
.FontStyle = "Gras"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("B:B" ).Select
Selection.Delete Shift:=xlToLeft
Range("C2" ).Select
ActiveCell.FormulaR1C1 = _
"" & Chr(10) & "SELECT " & Chr(10) & "TableName," & Chr(10) & "ColumnName," & Chr(10) & "coalesce(ColumnUDTName,ColumnType) AS ""Type""," & Chr(10) & "CASE " & Chr(10) & "WHEN coalesce(ColumnUDTName,ColumnType) = 'AT'" & Chr(10) & "THEN 'TIME'" & Chr(10) & "WHEN coalesce(ColumnUDTName,ColumnType) = 'BO'" & Chr(10) & "THEN 'BLOB'" & Chr(10) & "WHEN coalesce(ColumnUDTName,ColumnType) = 'BF'" & Chr(10) & "THEN 'BYTE'" & Chr(10) & "WHEN coalesce(ColumnUDTName,ColumnType) = 'BV'" & Chr(10) & "THEN 'VARBYTE'" & Chr(10) & "WHEN coalesce(ColumnUDTName,ColumnType) = 'CF'" & Chr(10) & "THEN 'CHAR'" & Chr(10) & "WHEN coalesce(ColumnUDTName,ColumnType) = 'CO'" & Chr(10) & "THEN 'CLOB'" & Chr(10) & "WHEN coalesce(ColumnUDTName,ColumnType) = 'CV'" & Chr(10) & "THEN 'VARCHAR'" & Chr(10) & "WHEN coalesce(ColumnUDTName,ColumnType) = 'D'" & Chr(10) & "THEN 'DECIMAL'" & Chr(10) & "WHEN coalesce(ColumnUDTName,ColumnType) = 'DA'" & Chr(10) & "THEN 'DATE'" & Chr(10) & "WHEN coalesce(ColumnUDTName,ColumnType) = 'F'" & Chr(
WHEN coalesce(ColumnUDTName,ColumnType) = 'I1'"&chr(10)&"THEN 'BYTEINT'"&chr(10)&"WHEN coalesce(ColumnUDTName,ColumnType) = 'I2'"&chr(10)&"THEN 'SMALLINT'"&chr(10)&"WHEN coalesce(ColumnUDTName,ColumnType) = 'TS'"&chr(10)&"THEN 'TIMESTAMP'"&chr(10)&"END,"&chr(10)&""
With ActiveCell.Characters(Start:=1, Length:=255).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Windows("fiche_dev.xlsx" ).Activate
Windows("base.xlsx" ).Activate
ActiveWindow.Close
Windows("Classeur12" ).Activate
Range("D2" ).Select
ActiveCell.FormulaR1C1 = _
"ColumnLength AS Length," & Chr(10) & "ColumnFormat AS ""Format""," & Chr(10) & "CASE CharType " & Chr(10) & "WHEN 1 THEN 'Latin'" & Chr(10) & "WHEN 2 THEN 'Unicode'" & Chr(10) & "WHEN 3 THEN 'KanjiSJIS'" & Chr(10) & "WHEN 4 THEN 'Graphic'" & Chr(10) & "WHEN 5 THEN 'Kanji1'" & Chr(10) & "ELSE NULL " & Chr(10) & "END (TITLE 'CharSet')," & Chr(10) & "Nullable," & Chr(10) & "DefaultValue," & Chr(10) & "ColumnTitle," & Chr(10) & "CommentString " & Chr(10) & "FROM dbc.ColumnsV " & Chr(10) & "WHERE DataBaseName='DZUDA0DTWH_WRK_0'" & Chr(10) & "AND TableName IN" & Chr(10) & ""
With ActiveCell.Characters(Start:=1, Length:=255).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("E2" ).Select
ActiveCell.FormulaR1C1 = "ORDER BY TableName,ColumnId;"
Range("F2" ).Select
ActiveCell.FormulaR1C1 = _
""" "";""("";""'"";'récap tables'!A2;""'"";"","";""'"";'récap tables'!A3;""'"";"","";""'"";'récap tables'!A4;""'"";"","";""'"";'récap tables'!A5;""'"";"","";""'"";'récap tables'!A6;""'"";"","";""'"";'récap tables'!A7;""'"";"","";""'"";'récap tables'!A8;""'"";"","";""'"";'récap tables'!A9;""'"";"","";""'"";'récap tables'!A10;""'"";"","";""'"";'récap tables'!A11;""'"";"","";""'"";'récap tables'!A12;""'"";"","";""'"";'récap tables'!A14;""'"";"","";""'"";'récap tables'!A15;""'"";"","";""'"";'récap tables'!A16;""'"";"","";""'"";'récap tables'!A17;""'"";"","";""'"";'récap tables'!A18;""'"";"","";""'"";'récap tables'!A19;""'"";"","";""'"";'récap tables'!A20;""'"";"","";""'"";'récap tables'!A21;""'"";"","";""'"";'récap tables'!A22;""'"";"","";""'"";'récap tables'!A23;""'"";"","";""'"";'récap tables'!A24;""'"";"","";""'"";'récap tables'!A25;""'"";"","";""'"";'récap tables'!A26;""'"";"","";""'"";'récap tables'!A27;""'"";"","";""'"";'récap tables'!A28;""'"";"","";""'"";'récap tables'!A29;""'"";"","";""'"";'réca
p tables '!A30;""'"";"" )""; "" "" ;"
Range("F2" ).Select
Selection.Columns.AutoFit
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
End Sub
Marsh Posté le 23-04-2012 à 14:53:25
Bonjour,
J'aurais réellement besoin d'aide pour travailler sur un fichier excel dans lequel je dois faire des maccros vba.
En effet, dans un onglet "extraction" de manière automatique un tableau se remplie.
et je voudrais qu'il s'enregistre ensuite dansun autre onglet " récap" en fonction de la Cellule "P2" qui correspond à un mois.
omme ça des que je changerais le mois, j'aimerais que les informations du tableau aille directement s enregistrer dans la cellule et colonne correspondante.
A l'aide