Re : Reorganiser le contenu d'une cellule
J ai trouvé un code sur le site qui fait presque ce que je ve.
Cependant, il y a un petit probleme que je n arrive pas a réglé.
Voici le code:
Private Sub CommandButton1_Click()
Dim Cel As Range
Dim Dte As Date
Dim DerLig As Long, DerLig2 As Long
DerLig = [A65000].End(xlUp).Row
For Each Cel In Sheets("Email").Range("B2:B30" & DerLig).SpecialCells(xlCellTypeConstants, 23)
tmp = Split(Cel, Chr(10))
Dte = Cells(Cel.Row, 1)
For i = LBound(tmp) To UBound(tmp)
With Sheets("Sheet1")
DerLig2 = .[A65000].End(xlUp).Row + 1
.Cells(DerLig2, 2).Value = tmp(i)
.Cells(DerLig2, 1).Value = Dte
End With
Next i
Next Cel
End Sub
Seuleument, ce code trie les données en descendant dans la tableur alors que je voudrais qu'il aille de gauche a droite.
J'ai essayé en changeant (en rouge):
Private Sub CommandButton1_Click()
Dim Cel As Range
Dim Dte As Date
Dim DerLig As Long, DerLig2 As Long
DerLig = [A65000].End(xlUp).Row
For Each Cel In Sheets("Email").Range("B2:B30" & DerLig).SpecialCells(xlCellTypeConstants, 23)
tmp = Split(Cel, Chr(10))
Dte = Cells(Cel.Row, 1)
For i = LBound(tmp) To UBound(tmp)
With Sheets("Sheet1")
DerLig2 = .[A65000].End(xlUp).
Column + 1
.Cells(DerLig2, 2).Value = tmp(i)
.Cells(DerLig2, 1).Value = Dte
End With
Next i
Next Cel
End Sub
Mais les lignes s'inscrivent les unes sur les autres dans la même cellule.
Quelqun a t'il la solution pour que une fois qu'il a rempli une cellule, il passe a celle de droite.
Merci beaucoup