1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| Sub dams()
Dim nbrelignesX As Double, nbrelignesY As Double, nbremaillesX As Double, nbremaillesY As Double, nombrelignescolonnes As Double, tampon1 As Double, tampon2 As Double
nbremaillesX = Sheets("charm1").Cells(1, 8)
nbremaillesY = Sheets("charm1").Cells(2, 8)
nbrelignesX = nbremaillesX + 1
nbrelignesY = nbremaillesY + 1
nbrelignescolonnes = nbremaillesX * nbremaillesY
For i = 1 To nbrelignescolonnes - 1
Cells(i, 1).TextToColumns Destination:=Cells(i, 1), DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1), Array(2, 1), Array(4, 1)), TrailingMinusNumbers:=True
Next i
Cells(nbrelignescolonnes, 1).TextToColumns Destination:=Cells(nbrelignescolonnes, 1), DataType:=xlFixedWidth _
, FieldInfo:=Array(Array(0, 1), Array(2, 1), Array(5, 1)), TrailingMinusNumbers _
:=True
For i = 1 To nbrelignescolonnes
tampon1 = Sheets("charm1").Cells(i, 1).Value
tampon2 = Sheets("charm1").Cells(i, 2).Value
Cells(i, 3).Value.Copy
Sheets("charm1").Cells(10 + tampon1, 10 + tampon2).Paste
Next i
End Sub |
Partager