VBA Excel Mettre une commande à la fin du Macro

Résolu
cs_JeffC1977 Messages postés 928 Date d'inscription vendredi 10 novembre 2000 Statut Membre Dernière intervention 23 septembre 2023 - 18 mai 2006 à 17:58
sdaouda Messages postés 1 Date d'inscription lundi 8 octobre 2007 Statut Membre Dernière intervention 10 octobre 2007 - 10 oct. 2007 à 21:03
Salut...

C'est la première fois que je veux "jouer" avec du VBA...

Je me suis fais un Macro avec Excel

Mon problème est que je dois insérer du Texte dans la derniere Cellule de la Colonne A à la fin des Lignes

En d'autres mots,

J'utilise 100 ligne je dois faire apparaître une ligne de texte dans ma Cellule A101
Si j'utilise 352 Lignes, je dois faire apparaître une ligne de texte dans ma Cellule A353

Mon Macro ouvre un Fichier Texte (il se peut qu'il aille de 5 à 400 lignes de texte) et je dois insérer ce commentaire (&PMGNCMD.END*3D) à la dernière ligne de texte du fichier.

Je mets le Code du Macro si ca peut aider.... 

P.S. Le Macro est fais qu'avec quelques lignes... Cependant il sera modifier plus tard avec 300 lignes

Sub GPS()
'
' GPS Macro
' Macro enregistrée le 2006-05-18 par Jeff
'
' Touche de raccourci du clavier: Ctrl+t
'
    ChDir "C:\Documents and Settings\jeff\Bureau"
    Workbooks.OpenText Filename:= _
        "C:\Documents and Settings\jeff\Bureau\Copie de GPS.txt", Origin:=xlWindows, _
        StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1), Array(2, _
        1), Array(16, 1), Array(25, 1), Array(31, 1), Array(40, 1), Array(56, 1), Array(62, 1), _
        Array(63, 1), Array(64, 1), Array(66, 1), Array(67, 1), Array(68, 1), Array(70, 1))
    Rows("1:4").Select
    Selection.Delete Shift:=xlUp
    ActiveWindow.SmallScroll ToRight:=5
    Columns("H:H").Select
    Selection.Delete Shift:=xlToLeft
    Columns("J:J").Select
    Selection.Delete Shift:=xlToLeft
    Range("L1").Select
    ActiveCell.FormulaR1C1 = "= IF(RC[-3]="""",RC[-1],RC[-3])"
    Range("L1").Select
    Selection.AutoFill Destination:=Range("L1:L14"), Type:=xlFillDefault
    Range("L1:L14").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    Columns("I:I").Select
    Application.CutCopyMode = False
    Selection.Delete Shift:=xlToLeft
    Columns("J:J").Select
    Selection.Delete Shift:=xlToLeft
    Columns("F:F").Select
    Selection.ClearContents
    ActiveWindow.LargeScroll ToRight:=-1
    Columns("D:D").Select
    Selection.Insert Shift:=xlToRight
    Selection.Insert Shift:=xlToRight
    Selection.Insert Shift:=xlToRight
    Range("D1").Select
    ActiveCell.FormulaR1C1 = "=((ABS(INT(RC[-1]*100)-(RC[-1]*100))*100)/60)*1000"
    Range("E1").Select
    ActiveCell.FormulaR1C1 = "=ROUND(RC[-1],0)"
    Range("F1").Select
    ActiveCell.FormulaR1C1 = _
        "=IF(RC[-1]<10,""00""&RC[-1],IF(RC[-1]<100,""0""&RC[-1],RC[-1]))"
    Range("G1").Select
    ActiveCell.FormulaR1C1 = "=CONCATENATE((LEFT(RC[-4],5))*100&""."",RC[-1])"
    Range("D1:G1").Select
    Selection.AutoFill Destination:=Range("D1:G14"), Type:=xlFillDefault
    Range("D1:G14").Select
    ActiveWindow.SmallScroll ToRight:=5
    Range("I1").Select
    ActiveCell.FormulaR1C1 = "=((ABS(INT(RC[-1]*100)-(RC[-1]*100))*100)/60)*1000"
    Range("J1").Select
    ActiveCell.FormulaR1C1 = "=ROUND(RC[-1],0)"
    Range("K1").Select
    ActiveCell.FormulaR1C1 = _
        "=IF(RC[-1]<10,""00""&RC[-1],IF(RC[-1]<100,""0""&RC[-1],RC[-1]))"
    Range("L1").Select
    ActiveCell.FormulaR1C1 = "=CONCATENATE((LEFT(RC[-4],5))*100&""."",RC[-1])"
    Range("I1:L1").Select
    Selection.AutoFill Destination:=Range("I1:L14"), Type:=xlFillDefault
    Range("I1:L14").Select
    Range("L1:L14").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    Columns("H:K").Select
    Range("K1").Activate
    Application.CutCopyMode = False
    Selection.Delete Shift:=xlToLeft
    ActiveWindow.LargeScroll ToRight:=-1
    Range("G1:G14").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    Columns("C:F").Select
    Range("F1").Activate
    Application.CutCopyMode = False
    Selection.Delete Shift:=xlToLeft
    Columns("A:A").Select
    Selection.Cut
    Range("G1").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll ToRight:=3
    Range("J1").Select
    ActiveCell.FormulaR1C1 = "'$PMGNWPL,"
    Range("J2").Select
    ActiveCell.FormulaR1C1 = "',N,0"
    Range("J3").Select
    ActiveCell.FormulaR1C1 = "',W,0000275,M,"
    Range("J4").Select
    ActiveCell.FormulaR1C1 = "',a*2d"
    Range("J5").Select
    ActiveWindow.LargeScroll ToRight:=-1
    Range("A1").Select
    ActiveCell.FormulaR1C1 = _
        "=IF(RC[3]="""",""$PMGNCMD,END*3D"",CONCATENATE(R1C11,R1C4,R2C11,R1C5,R3C11,RC[6]&"","",RC[7],R4C11))"
    Range("A2").Select
    Columns("A:A").EntireColumn.AutoFit
    Columns("C:C").Select
    Selection.Insert Shift:=xlToRight
    Range("A1").Select
    ActiveCell.FormulaR1C1 = _
        "=IF(RC[3]="""",""$PMGNCMD,END*3D"",CONCATENATE(R1C11,R1C4,R2C11,R1C5,R3C11,RC[6]&"","",RC[7],R4C11))"
    Range("A2").Select
    Columns("A:A").EntireColumn.AutoFit
    Range("A1").Select
    Selection.AutoFill Destination:=Range("A1:A14"), Type:=xlFillDefault
    Range("A1:A14").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    Columns("D:L").Select
    Application.CutCopyMode = False
    Selection.ClearContents
    ActiveWindow.LargeScroll ToRight:=-1
    Range("A1").Select
End Sub

2 réponses

cs_loulou69 Messages postés 672 Date d'inscription mercredi 22 janvier 2003 Statut Membre Dernière intervention 2 juin 2016 1
19 mai 2006 à 11:28
Bonjour
Je te propose cela :

ActiveSheet.Cells( Range("A1").End(xlDown).Row+1, 1).Value="&PMGNCMD.END*3D"
3
sdaouda Messages postés 1 Date d'inscription lundi 8 octobre 2007 Statut Membre Dernière intervention 10 octobre 2007
10 oct. 2007 à 21:03
bonjour,
y a t il qlq un qui peut me proposer un code VB sous forme de macro, qui me permettra d inserer des bouttons radio ou selecteur dans un graphique multi courbe, de facon a faire apparaitre ou disparaitre une courbe en selectionnant ou deselectionnant un boutton.

Merci
0
Rejoignez-nous