Macro Copier Coller avec Multiplication excel 2007

ArnoC -  
Le Pingou Messages postés 12656 Date d'inscription   Statut Contributeur Dernière intervention   -
Bonjour,
au Forum et à l'aide !
J'ai une colonne remplie de texte du style 96.78%
afin de faire une transfo rapide en nombre,
j'ai suivi la méthode du copier coller "multiplication" en ayant auparavant créer une colonne de 1 ...
Tout va bien c'est vraiment super
donc j'ai voulu l'enregistrer sous macro (en utilisant l'enregistreur)
et là tout va bien sauf qu'avec la macro,
le résultat final est toujours 1 dans toutes les celulles
que se passe t il ?

Merci de votre aide !!!

Sub Macro2()
'
' Macro2 Macro
'

'
Range("P10").Select
ActiveCell.FormulaR1C1 = "0.01"
Range("P10").Select
Selection.AutoFill Destination:=Range("P10:P50"), Type:=xlFillDefault
Range("P10:P50").Select
Range("H10:H50").Select
Range("H50").Activate
Selection.Copy
Range("P10:P50").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Style = "Percent"
Selection.NumberFormat = "0.0%"
Selection.NumberFormat = "0.00%"
Selection.Copy
Range("H10:H50").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.NumberFormat = "0.0%"
Selection.NumberFormat = "0.00%"
Range("Q3").Select
End Sub


A voir également:

2 réponses

@nnie Messages postés 2261 Date d'inscription   Statut Membre Dernière intervention   611
 
Bonjour,

Juste une question : en l'occurrence, pourquoi vouloir passer par une macro ?
0
Le Pingou Messages postés 12656 Date d'inscription   Statut Contributeur Dernière intervention   1 466
 
Bonjour,
Juste au passage, votre macro enregistrer reflète ce que vous avez réalisé et c'est certainement faux.
Elle devrait ressembler a ceci (pourcent à convertir [B2 :B18] et le multiplicateur 1 en [D2]) :
Sub Macro1()
'
    Range("D2").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("D2").Select
    Selection.Copy
    Range("B2:B18").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
        SkipBlanks:=False, Transpose:=False
End Sub

0