Bonjour,
J'aimerais passer en argument une "Range" de cellules pour une fonction en VB. Voici mon code :
Cette fonction fonctionne lorsque je passe une seule cellule en argument :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
36
37
38
39
40
41
42
43
44
45
46
47 Dim Rng As Range ' Appel de la fonction Set Rng = Range("B4:C7") Entourage_Cellule (Rng) 'Fonction Entourage_Cellule Function Entourage_Cellule(Rng As Range) Rng.Select With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .ColorIndex = xlAutomatic .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = xlAutomatic .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = xlAutomatic .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = xlAutomatic .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .ColorIndex = xlAutomatic .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .ColorIndex = xlAutomatic .TintAndShade = 0 .Weight = xlThin End With End FunctionMais lorsque je fais l'appel comme au-dessus j'ai une erreur de type : " Erreur d'exécution '424': Objet Requis".
Code : Sélectionner tout - Visualiser dans une fenêtre à part Entourage_Cellule(Cells(ligne, colonne))
Pouvez-vous me dire ce qu'il cloche ? J'ai déjà surfer sur le net mais ça ne m'a pas résolu le problème.
PS: J'ai aussi réalisé ce test :
Code : Sélectionner tout - Visualiser dans une fenêtre à part Entourage_Cellule(Range("B4:C7"))
Partager