Bonjour
j'ai une macro prenant dans un fichier diverses données mais lorsque je la lance la macro stoppe et me met ce message : Erreur d'execution 1004 et surlignant ceci
: Sheets("tableau").Cells(ligne, 3) = adrdesta2
voici tout le reste du code
Sub CSuppEntetePusatyp()
' ajout de la feuille tableau
Sheets.Add
Sheets("feuil1").Select
Sheets("feuil1").Name = ("tableau")
'nombre de pro
Dim nom
Dim adr1
Dim codepost
Dim ville
Dim ligne
nom = "["
ligne = 1
For rang = 1 To 10000
ranga = Sheets("p_usatyp").Cells(rang, 1)
nomdest = InStr(ranga, nom)
If nomdest = "1" Then nomdesta = Sheets("p_usatyp").Cells(rang, 1): Sheets("tableau").Cells(ligne, 1) = nomdesta: adrdesta = Sheets("p_usatyp").Cells(rang + 2, 1): Sheets("tableau").Cells(ligne, 2) = adrdesta: adrdesta1 = Sheets("p_usatyp").Cells(rang + 3, 1): Sheets("tableau").Cells(ligne, 4) = adrdesta1: adrdesta2 = Sheets("p_usatyp").Cells(rang + 4, 1): Sheets("tableau").Cells(ligne, 3) = adrdesta2: ligne = ligne + 1
Next
Sheets("tableau").Select
nombre = 0
For Each ran In Range("a1:a7000")
If ran <> "" Then nombre = nombre + 1 Else GoTo 100
Next
100 nombre = nombre + 1
'nom
ote = "[BUDL]"
For rang = 1 To nombre
nom = Cells(rang, 1)
budl = InStr(nom, ote)
budl = budl - 1
If budl > 0 Then nomdef = Left(nom, budl): nomdefa = Mid(nomdef, 8): Cells(rang, 1) = nomdefa
Next
'adresse
For rang = 1 To nombre
adra = Cells(rang, 2)
adrdef = Mid(adra, 18)
Cells(rang, 2) = adrdef
Next
'ville
For rang = 1 To nombre
ville = Cells(rang, 4)
villa = Mid(ville, 18)
Cells(rang, 4) = villa
Next
Trouvez des réponses à vos questions sur les langages, les frameworks et les astuces de codage. Échangez avec d'autres développeurs passionnés pour améliorer vos compétences en programmation et rester au fait des dernières tendances du secteur.