1 2 3 4 5 6 7 8 9 10 11 12 13
| Sub test2()Dim Formule$, Trouve, Remplace, T, i As Byte ' , k as Byte
Formule = "PourModifierMaFormule!Outillage'!$D$10:$T$90;17;"
Trouve = Array("folder", "Outillage'!$M$10:$U$500;3;", "Outillage'!$T$10:$U$500;3;", "Outillage'!$M$10:$U$500;2;", "Outillage'!$M$10:$U$500;3;", "Outillage'!$M$2:$U$500;2;", "Outillage'!$D$10:$T$90;17;")
Remplace = Array("M:\", "Outillage'!$M$2:$U$500;3;", "Outillage'!$M$2:$U$500;3;", "Outillage'!$M$2:$U$500;3;", "Outillage'!$M$2:$U$500;3;", "Outillage'!$M$2:$U$500;3;", "Outillage'!$B$1:$I$65536;8;")
i = 0 ' on supprime si on utilise For k
For Each T In Trouve ' OU => For k = 0 to Ubound(Trouve)
If InStr(Formule, T) > 0 Then ' If InStr(Formule, Trouve(k)) Then
Formule = Replace(Formule, Trouve(i), Remplace(i)) ' Formule = Replace(Formule, Trouve(k), Remplace(k))
End If
i = i + 1 ' on supprime si on utilise For k
Next
Debug.Print Formule
End Sub |