Séparer une colonne sous une condition

harbouli

XLDnaute Nouveau
Bonjour Mes amis,

je veins d'élaborer cette macro mais je suis coincé sur une modification:

Je veux que la colonne G soit séparé sous une condition: si le chiffre dans la cellule est positif, il se deplace vers la colonne H sinon il rest dans la meme cellule,

Merci de voir le fichier cijoint.http://www.cjoint.com/c/GKrl2vdC0vl

Merci infiniment.
 

Pièces jointes

  • cuala version.xls
    135.5 KB · Affichages: 14

harbouli

XLDnaute Nouveau
je pense que je n'ai pas pu coller le code dans le bon endroit, merci de m'indiquer ou je dois coller ce code: voila le code complet:

Sub converter()
Dim sh As Worksheet
Dim ws As Worksheet
Dim a As Long
Dim b As Long

Set ws = Sheets("Input")
Set sh = Sheets("Output")

b = ws.Range("A1").End(xlDown).Row
c = sh.Range("A1").End(xlDown).Row
sh.Activate
sh.Range("A2", Cells(c, "I")).Clear
'sh.Range("A2", Cells(c, "I")).Interior.Color = RGB(255, 255, 255)
For a = 2 To b
sh.Cells(a, "C") = ws.Cells(a, "C")
sh.Cells(a, "A") = ws.Cells(a, "G")
sh.Cells(a, "E") = ws.Cells(a, "I")
sh.Cells(a, "B") = ws.Cells(a, "L")
sh.Cells(a, "G") = ws.Cells(a, "M")
sh.Cells(a, "D") = ws.Cells(a, "X")


Next
sh.Range("A2", Cells(b, "A")).NumberFormat = "dd/mm/yyyy;@"

Dim maplageC As Range

Set maplageC = sh.Range("G2", Cells(b, "G"))

For Each cellule In maplageC
If cellule.Value > 0 Then
sh.Cells(cellule.Row, 6).Value = "C"
Else
sh.Cells(cellule.Row, 6).Value = "D"

End If

Next
End Sub
 

Discussions similaires

Statistiques des forums

Discussions
312 196
Messages
2 086 097
Membres
103 116
dernier inscrit
kutobi87