Ajouter un Underscore

maval

XLDnaute Barbatruc
Bonjour,

J'ai une chaine de mots dans une cellule "D4" et j'aimerai remplacer les espace par un underSore
en VBA
Je vous remercie d'avance

Cordialement

Max
 

Pièces jointes

  • underscore_cellule.xlsm
    8.1 KB · Affichages: 21

maval

XLDnaute Barbatruc
Re,

Je te remercie juste une info voici mon code
Code:
Sub Copy()
Dim Cel As Range
         Application.ScreenUpdating = False
        
       'Deuxième partie
     For Each Cel In Range("a6:a" & [a65000].End(xlUp).Row)
          Cells(3, "d") = Trim(Cells(3, "d")) & "','" & Cel
    Next Cel
        Cells(3, "d").Value = Mid(Cells(3, "d").Value, 2)
        Cells(3, "d").Value = "var txt = new Array ('" & Cells(3, "d").Value & "');"
       
     ' Deuxième partie avec Underscore
       'Deuxième partie
     For Each Cel In Range("a6:a" & [a65000].End(xlUp).Row)
   
             Cells(4, "d") = Trim(Cells(4, "d")) & "','" & "Communes/" & Cel & ".html"
            
    Next Cel
        Cells(4, "d").Value = Mid(Cells(4, "d").Value, 2)
        Cells(4, "d").Value = "var url = new Array ('" & Cells(4, "d").Value & "');"
         [D4].Replace What:=" ", Replacement:="_"
End Sub
Quand j’actionne mon code le problème et qu'il me met les underscore var url = new Array (
puisqu'il se trouve en "D4" y a t-il une solution pour eviter cela?

Merci

Max
 

Discussions similaires

  • Résolu(e)
Microsoft 365 Code de tri
Réponses
22
Affichages
207