I
itombof
Guest
BONJOUR JE CHERCHE à EXECUTER un code afin d'avoir la vrai valeur en euro quand le code est "15" et la devise est en "USD". donc dans la cellule F7 j'aurai
=C7/E7 = 838,71
Code Type ValoEuro Devise txchangedi vrai valeur en euro
3690 VAL 25311 JPY 108,95
3690 VAL 21445 EUR 1
72 CHG 17820 EUR 1
72 VAL -13931 CHF 1,3869
72 VAL 134 DKK 7,4376
15 CHG 1000 USD 1,1923 838,71
j'utilise cette macro qui n'est pas du tout efficace:
Sub Macro1()
Cells.Select
Selection.Find(What:="15", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
True, SearchFormat:=False).Activate
Selection.Find(What:="CHG", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate
Range("F7").Select
ActiveCell.FormulaR1C1 = "=RC[-3]/RC[-1]"
End Sub
SINON J'AI éCRIT 2 CODES DIFFéRENTS MAIS NE FONCTIONNE TOUJOURS PAS CAR LE DéCALLAGE SE FAIT TOUJours à gauche et ne s'arrete jamais. que faut il faire? merci d'avance....
Sub valeurEuro2()
Dim LIGNE As Long
LIGNE = [a2].End(xlDown).Row
Range(Cells(LIGNE, 1), Cells(LIGNE, 6)).Select
For I = 1 To LIGNE
If ActiveSheet.Cells(LIGNE, 1).Value = 15 And ActiveSheet.Cells(LIGNE, 2).Value = "CHG" Then
ActiveCell.Select
ActiveCell.Offset(0, 5).Select
ActiveCell.FormulaR1C1 = "=RC[-3]/RC[-1]"
ActiveCell.Offset(1, -5).Select
End If
Next I
End Sub
Sub valeurEuro()
Dim LIGNE As Long
LIGNE = [a2].End(xlDown).Row
Cells(LIGNE, 1).Activate
Set area = Range(Cells(LIGNE, 1), Cells(LIGNE, 6))
For Each c In area
If ActiveSheet.Cells(LIGNE, 1).Value = 15 And ActiveSheet.Cells(LIGNE, 2).Value = "CHG" Then
ActiveCell.Select
ActiveCell.Offset(0, 5).Select
ActiveCell.FormulaR1C1 = "=RC[-3]/RC[-1]"
End If
Next
End Sub
=C7/E7 = 838,71
Code Type ValoEuro Devise txchangedi vrai valeur en euro
3690 VAL 25311 JPY 108,95
3690 VAL 21445 EUR 1
72 CHG 17820 EUR 1
72 VAL -13931 CHF 1,3869
72 VAL 134 DKK 7,4376
15 CHG 1000 USD 1,1923 838,71
j'utilise cette macro qui n'est pas du tout efficace:
Sub Macro1()
Cells.Select
Selection.Find(What:="15", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
True, SearchFormat:=False).Activate
Selection.Find(What:="CHG", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate
Range("F7").Select
ActiveCell.FormulaR1C1 = "=RC[-3]/RC[-1]"
End Sub
SINON J'AI éCRIT 2 CODES DIFFéRENTS MAIS NE FONCTIONNE TOUJOURS PAS CAR LE DéCALLAGE SE FAIT TOUJours à gauche et ne s'arrete jamais. que faut il faire? merci d'avance....
Sub valeurEuro2()
Dim LIGNE As Long
LIGNE = [a2].End(xlDown).Row
Range(Cells(LIGNE, 1), Cells(LIGNE, 6)).Select
For I = 1 To LIGNE
If ActiveSheet.Cells(LIGNE, 1).Value = 15 And ActiveSheet.Cells(LIGNE, 2).Value = "CHG" Then
ActiveCell.Select
ActiveCell.Offset(0, 5).Select
ActiveCell.FormulaR1C1 = "=RC[-3]/RC[-1]"
ActiveCell.Offset(1, -5).Select
End If
Next I
End Sub
Sub valeurEuro()
Dim LIGNE As Long
LIGNE = [a2].End(xlDown).Row
Cells(LIGNE, 1).Activate
Set area = Range(Cells(LIGNE, 1), Cells(LIGNE, 6))
For Each c In area
If ActiveSheet.Cells(LIGNE, 1).Value = 15 And ActiveSheet.Cells(LIGNE, 2).Value = "CHG" Then
ActiveCell.Select
ActiveCell.Offset(0, 5).Select
ActiveCell.FormulaR1C1 = "=RC[-3]/RC[-1]"
End If
Next
End Sub