VBA: Range avec variable
Fermé
jmarichal
-
7 juil. 2008 à 10:24
Shooshoo Messages postés 1 Date d'inscription jeudi 25 avril 2013 Statut Membre Dernière intervention 25 avril 2013 - 25 avril 2013 à 15:07
Shooshoo Messages postés 1 Date d'inscription jeudi 25 avril 2013 Statut Membre Dernière intervention 25 avril 2013 - 25 avril 2013 à 15:07
A voir également:
- Variable range
- Range variable vba - Meilleures réponses
- Range variable - Meilleures réponses
- Ce programme est écrit en python. il construit un mot secret dans une variable mais il ne l'affiche pas. modifiez-le pour qu'il affiche le mot secret. exécutez-le. quel est ce mot secret ? ✓ - Forum Python
- Vba range avec variable ✓ - Forum VB / VBA
- Input signal out of range ✓ - Forum Matériel informatique
- Range ip ✓ - Forum Windows
- Syntaxe VBA Sheets.Range avec Range variable ✓ - Forum VB / VBA
3 réponses
michel_m
Messages postés
16596
Date d'inscription
lundi 12 septembre 2005
Statut
Contributeur
Dernière intervention
6 juin 2023
3 294
7 juil. 2008 à 10:35
7 juil. 2008 à 10:35
Bonjour,
Sub selectionner_zone()
Dim myrange As Range
j = Range("A1").CurrentRegion.Rows.Count
Set myrange = Range(Cells(j, 1), Cells(j, 3))
'test macro: on colorie la zone sélectionnée myrange en jaune
myrange.Interior.ColorIndex = 6
Set myrange = Nothing
End Sub
il fallait déclarer et instancier myrange
activecell ne servait à rien
Michel
Sub selectionner_zone()
Dim myrange As Range
j = Range("A1").CurrentRegion.Rows.Count
Set myrange = Range(Cells(j, 1), Cells(j, 3))
'test macro: on colorie la zone sélectionnée myrange en jaune
myrange.Interior.ColorIndex = 6
Set myrange = Nothing
End Sub
il fallait déclarer et instancier myrange
activecell ne servait à rien
Michel