Code pour separation de données

Bonjour,

J’ai un petit bout de code qui me permet d’exporter de la data provenant d’un fichier xml dans un classeur excel, cependant il me colle l’integralité des données (2565 valeurs) dans une seule cellule. J’ai donc ecrit un autre petit bout de code pour séparer ces 2565 valeurs dans 2565 cases séparées. Ces valeurs sont initialement séparées par des espaces. Ca ne marche bien évidemment pas, c’est donc pour ca que je vient demander de l’aide ici, car je ne comprends pas pourquoi ? Voici le bout de code :

Sub SeparateValuesInCell()
Dim str As String
Dim arr() As String
Dim i As Integer

'Change the cell reference to the cell containing the values you want to separate
str = Range("A1").Value

'Split the values in the cell by spaces and store them in an array
arr = Split(str, " ")

'Loop through the array and place each value in a separate cell in the same row
For i = 0 To UBound(arr)
    'Change the column reference to the column where you want to place the separated values
    Cells(1, i + 1).Value = arr(i)
Next i

End Sub

Si Quelqun peut m’aider ce serai vraiment cool ! merci

Bonjour,
Il nous faut plutôt le fichier si possible.
Cordialement
Will-Fread

Bonjour, je n’arrive pas envoyer d’xml, cependant voici le fichier Excel
Book3.xlsm (22,1 Ko)

1 « J'aime »

Re,

Essayer de l’mettre en format texte et réessayer.

Cordialement

<?xml version="1.0"?>

-

Wed Mar 22 15:40:04 2023

<ACCESS_MODE>RW</ACCESS_MODE>

<SENSOR_CONFIG_NAME>1200_sens_Oak_Beausoleil</SENSOR_CONFIG_NAME>

<SENSOR_ID>0</SENSOR_ID>

<SIDE_ID>0</SIDE_ID>

IVP Ranger3

-

3D.Range

SIGNAL

255 0 0

2560

1

<bytes_per_pixel>1</bytes_per_pixel>

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

d

Wed Mar 22 15:40:04 2023

<exposure_time/>

<start_row/>

<number_of_rows/>

-

3D.Direct

SIGNAL

0 255 0

2560

1

<bytes_per_pixel>1</bytes_per_pixel>

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

d

Wed Mar 22 15:40:04 2023

<exposure_time/>

<start_row/>

<number_of_rows/>

-

3D.Scatter

SIGNAL

100 100 255

2560

1

<bytes_per_pixel>1</bytes_per_pixel>

0 29 71 68 0 74 68 0 0 0 83 0 0 0 0 0 0 0

d

Wed Mar 22 15:40:04 2023

<exposure_time/>

<start_row/>

<number_of_rows/>

-

DOT.DOT1

SIGNAL

255 255 255

2560

1

<bytes_per_pixel>1</bytes_per_pixel>

0 0 0 0 0 0 0 0 0 0 0 0 104 103

d

Wed Mar 22 15:40:04 2023

<exposure_time/>

<start_row/>

<number_of_rows/>

-

DOT.DOT2

SIGNAL

255 255 255

2560

1

<bytes_per_pixel>1</bytes_per_pixel>

0 0 0 0 0 0 0 0 0 0 0 0 0 99 902 102 102 103

d

Wed Mar 22 15:40:04 2023

<exposure_time/>

<start_row/>

<number_of_rows/>

-

Angle1.Gray

SIGNAL

200 200 200

2560

1

<bytes_per_pixel>1</bytes_per_pixel>

121 123 107 102 145 144 103 95

d

Wed Mar 22 15:40:04 2023

<exposure_time/>

<start_row/>

<number_of_rows/>

-

Angle2.Gray

SIGNAL

200 200 200

2560

1

<bytes_per_pixel>1</bytes_per_pixel>

110 100 93 11 196 160

d

Wed Mar 22 15:40:04 2023

<exposure_time/>

<start_row/>

<number_of_rows/>

Et bien je disais que vous pouvez enregistrer le fichier en format texte et envoyer le fichier en commentaire.

xmlfile.xlsx (25,1 Ko)j’ai pas reussi à faire mieux, les fichiers txt ne passent pas, rien ne passe enfait haha

Ce sujet a été automatiquement fermé après 30 jours. Aucune réponse n’est permise dorénavant.