Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Déplacer un objet range sur des plages de cellules éloignées de 3 colonnes.

4 réponses
Avatar
Tintin92
Bonjour,

Je souhaiterai d=E9placer un objet range sur des plages de cellules
=E9loign=E9es de 3 colonnes.


Dim myRange As Range
For i =3D 1 To 6
Set myRange =3D Range("J7:J17")
myRange.Interior.ColorIndex =3D 6
myRange.Interior.Pattern =3D xlSolid

Comment ajouter 3 colonnes =E0 Range("J7:J17") ?

Next i

Merci

Tintin92

4 réponses

Avatar
ThierryP
Bonsoir Tintin92,

Avec ceci : Range("J17").offset(x, y).select où : x est le nombre de
lignes et y le nombre de colonnes (positifs = en bas ou à droite,
négatif au-dessus ou à gauche)

Bonjour,

Je souhaiterai déplacer un objet range sur des plages de cellules
éloignées de 3 colonnes.


Dim myRange As Range
For i = 1 To 6
Set myRange = Range("J7:J17")
myRange.Interior.ColorIndex = 6
myRange.Interior.Pattern = xlSolid

Comment ajouter 3 colonnes à Range("J7:J17") ?

Next i

Merci

Tintin92



--
@+ thierryp

Avatar
michdenis
Bonjour Tintin92,

Comment ajouter 3 colonnes à Range("J7:J17") ?

La colonne J fait parti des 3 colonnes
Range("J7:J17").resize(,3)

Pour 3 colonnes supplémentaires à la colonne J
Range("J7:J17").resize(,4)


Salutations!




"Tintin92" a écrit dans le message de news:
Bonjour,

Je souhaiterai déplacer un objet range sur des plages de cellules
éloignées de 3 colonnes.


Dim myRange As Range
For i = 1 To 6
Set myRange = Range("J7:J17")
myRange.Interior.ColorIndex = 6
myRange.Interior.Pattern = xlSolid

Comment ajouter 3 colonnes à Range("J7:J17") ?

Next i

Merci

Tintin92
Avatar
Tintin92
Bonjour,

Je remercie tout ceux qui m'ont répondu.

Je crois que j'ai réussi à faire ce que je voulais faire.

Private Sub CommandButton5_Click()
Dim myRange As Range
x = 0
For i = 1 To 6
Set myRange = Range(Cells(7, 9).Offset(0, x), Cells(18,
9).Offset(0, x))
myRange.Interior.ColorIndex = 6
myRange.Interior.Pattern = xlSolid
x = x + 3
Next i
End Sub
Avatar
michdenis
Bonjour Tintin92,

Il y avait ceci : c'est l'équivalent de ton code :
'-------------------
Private Sub CommandButton5_Click()
Dim i As Integer, x As Integer
For i = 1 To 6
With Range("i7:i17").Offset(, x)
.Interior.ColorIndex = 6
.Interior.Pattern = xlSolid
End With
x = x + 3
Next i
End Sub
'-------------------

Salutations!


"Tintin92" a écrit dans le message de news:
Bonjour,

Je remercie tout ceux qui m'ont répondu.

Je crois que j'ai réussi à faire ce que je voulais faire.

Private Sub CommandButton5_Click()
Dim myRange As Range
x = 0
For i = 1 To 6
Set myRange = Range(Cells(7, 9).Offset(0, x), Cells(18,
9).Offset(0, x))
myRange.Interior.ColorIndex = 6
myRange.Interior.Pattern = xlSolid
x = x + 3
Next i
End Sub