OVH Cloud OVH Cloud

Boucle en VB

2 réponses
Avatar
maryola
Bonjour,
j'ai fait un mini code que voici :
Range("P1").Select
Selection.Copy
Range("H2:H10000").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlMultiply, SkipBlanks:= _
False, Transpose:=False
Truc simple.
Cependant, je ne voudrais pas mettre H2:H10000, je voudrais qu'il le fasse
jusqu'à la fin du tableau.
Comment fait on ?
Merci encore pour votre aide!

2 réponses

Avatar
Yvan
Bonjour *Maryola*

Il faut remplacer
Range("H2:H10000").Select
par
Range("H2:H" & Range("H2").End(xlDown).Row).Select

et, encompactant un peu le code initial:
Range("P1").Copy
Range("H2:H" & Range("H2").End(xlDown).Row).PasteSpecial _
Paste:=xlAll, Operation:=xlMultiply, SkipBlanks:úlse, Transpose:úlse

@+
Yvan

"maryola" a écrit dans le message de news:

| Bonjour,
| j'ai fait un mini code que voici :
| Range("P1").Select
| Selection.Copy
| Range("H2:H10000").Select
| Selection.PasteSpecial Paste:=xlAll, Operation:=xlMultiply, SkipBlanks:= _
| False, Transpose:úlse
| Truc simple.
| Cependant, je ne voudrais pas mettre H2:H10000, je voudrais qu'il le fasse
| jusqu'à la fin du tableau.
| Comment fait on ?
| Merci encore pour votre aide!
Avatar
maryola
MErci beaucoup de ton aide, ça marche trop trop bien


Bonjour *Maryola*

Il faut remplacer
Range("H2:H10000").Select
par
Range("H2:H" & Range("H2").End(xlDown).Row).Select

et, encompactant un peu le code initial:
Range("P1").Copy
Range("H2:H" & Range("H2").End(xlDown).Row).PasteSpecial _
Paste:=xlAll, Operation:=xlMultiply, SkipBlanks:úlse, Transpose:úlse

@+
Yvan

"maryola" a écrit dans le message de news:

| Bonjour,
| j'ai fait un mini code que voici :
| Range("P1").Select
| Selection.Copy
| Range("H2:H10000").Select
| Selection.PasteSpecial Paste:=xlAll, Operation:=xlMultiply, SkipBlanks:= _
| False, Transpose:úlse
| Truc simple.
| Cependant, je ne voudrais pas mettre H2:H10000, je voudrais qu'il le fasse
| jusqu'à la fin du tableau.
| Comment fait on ?
| Merci encore pour votre aide!