Traduction Formule excel en VBA

n3Twork

XLDnaute Occasionnel
Bonjour,

jai un petit probleme comment ecrire cette formule ci en VBA ?

Code:
=SI(ESTTEXTE(AJ211);'';AI211*GAUCHE(AJ211;2))

J'ai trouver ceci mais il y a un bug qlq part ....

Code:
'=IF(ISTEXT(RC[-1]),'''',RC[-2]*LEFT(RC[-1];2))'


merci

Message édité par: n3twork, à: 13/04/2006 14:37

Message édité par: n3twork, à: 13/04/2006 14:39
 

_Thierry

XLDnaute Barbatruc
Repose en paix
Bonjour N3Twork, le Forum

Vite fait, si j'ai bien compris...

Sub FormulaWriter()
    ActiveCell.Formula = _
    '=IF(ISTEXT(' & Range('AJ211').Address(0, 0) & '),'''',' & _
                    Range('AI211').Address(0, 0) & '*LEFT(' & _
                    Range('AJ211').Address(0, 0) & ',2))'
End Sub

Bon aprèm
[ol]@+Thierry[/ol]
 

_Thierry

XLDnaute Barbatruc
Repose en paix
Re

Dans ce cas là, écris ta formule avec l'enregistreur de Macros activé, et tu auras ta syntax en format R1C1

ActiveCell.FormulaR1C1 = _
'=IF(ISTEXT(R[210]C[35]),'''',R[210]C[34]*LEFT(R[210]C[35],2))'

Bon aprèm (je m'en vais chez le toubib maintenant)
[ol]@+Thierry[/ol]
 

Statistiques des forums

Discussions
312 489
Messages
2 088 855
Membres
103 979
dernier inscrit
bderradji