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

VBA selection de plage

3 réponses
Avatar
Domi
Bonsoir a tous,
un petit coup de main ?
With Range("N16:N" & Range("A65000").End(xlUp).Row)

Je voudrais dans ce petit bout de code remplacer la cellule de départ (N16)
par la première cellule vide (en partant du bas) de la même colonne N.
Remplacer N16 par quelque chose comme ça :
Range("N20000").End(xlUp).Offset(1, 0)
Je n'arrive pas à trouver la syntaxe adhoc.

Merci
Domi

3 réponses

Avatar
Denis
Bonjour Domi,

Je pense que tu pourrais faire quelque chose de ce genre (à adapter selon ce que tu veux
faire):


Sub SelectionPlage()
Dim CelluleDeDepart, CelluleDeFin As Range

Set CelluleDeDepart = Range("N16")
Set CelluleDeFin = Range("A65000").End(xlUp)

With Range(CelluleDeDepart.Address, CelluleDeFin.Address)
...
...
End With

Set CelluleDeDepart = Range("N20000").End(xlUp).Offset(1, 0)

With Range(CelluleDeDepart.Address, CelluleDeFin.Address)
...
...
End With
...
...
...
Set CelluleDeDepart = Nothing
Set CelluleDeFin = Nothing
End Sub


Denis


"Domi" a écrit dans le message news:
uksF9Y$
Bonsoir a tous,
un petit coup de main ?
With Range("N16:N" & Range("A65000").End(xlUp).Row)

Je voudrais dans ce petit bout de code remplacer la cellule de départ (N16)
par la première cellule vide (en partant du bas) de la même colonne N.
Remplacer N16 par quelque chose comme ça :
Range("N20000").End(xlUp).Offset(1, 0)
Je n'arrive pas à trouver la syntaxe adhoc.

Merci
Domi




Avatar
Denis
Bonjour Domi,
Correction:

Sub SelectionPlage()
Dim CelluleDeDepart, CelluleDeFin As Range

Set CelluleDeDepart = Range("N16")
Set CelluleDeFin = Range("A65000").End(xlUp)

With Range(CelluleDeDepart.Address, "N" & CelluleDeFin.Row)
...
...
End With

Set CelluleDeDepart = Range("N20000").End(xlUp).Offset(1, 0)

With Range(CelluleDeDepart.Address, "N" & CelluleDeFin.Row)
...
...
End With
...
...
...
Set CelluleDeDepart = Nothing
Set CelluleDeFin = Nothing
End Sub



"Denis" a écrit dans le message news:
S1Ajb.170416$
Bonjour Domi,

Je pense que tu pourrais faire quelque chose de ce genre (à adapter selon ce que tu veux
faire):


Sub SelectionPlage()
Dim CelluleDeDepart, CelluleDeFin As Range

Set CelluleDeDepart = Range("N16")
Set CelluleDeFin = Range("A65000").End(xlUp)

With Range(CelluleDeDepart.Address, CelluleDeFin.Address)
...
...
End With

Set CelluleDeDepart = Range("N20000").End(xlUp).Offset(1, 0)

With Range(CelluleDeDepart.Address, CelluleDeFin.Address)
...
...
End With
...
...
...
Set CelluleDeDepart = Nothing
Set CelluleDeFin = Nothing
End Sub


Denis


"Domi" a écrit dans le message news:
uksF9Y$
Bonsoir a tous,
un petit coup de main ?
With Range("N16:N" & Range("A65000").End(xlUp).Row)

Je voudrais dans ce petit bout de code remplacer la cellule de départ (N16)
par la première cellule vide (en partant du bas) de la même colonne N.
Remplacer N16 par quelque chose comme ça :
Range("N20000").End(xlUp).Offset(1, 0)
Je n'arrive pas à trouver la syntaxe adhoc.

Merci
Domi







Avatar
Domi
Merci Denis, ça marche ;o)
Domi

"Denis" a écrit dans le message de news:
tbAjb.170417$
Bonjour Domi,
Correction:

Sub SelectionPlage()
Dim CelluleDeDepart, CelluleDeFin As Range

Set CelluleDeDepart = Range("N16")
Set CelluleDeFin = Range("A65000").End(xlUp)

With Range(CelluleDeDepart.Address, "N" & CelluleDeFin.Row)
...
...
End With

Set CelluleDeDepart = Range("N20000").End(xlUp).Offset(1, 0)

With Range(CelluleDeDepart.Address, "N" & CelluleDeFin.Row)
...
...
End With
...
...
...
Set CelluleDeDepart = Nothing
Set CelluleDeFin = Nothing
End Sub



"Denis" a écrit dans le message news:
S1Ajb.170416$
Bonjour Domi,

Je pense que tu pourrais faire quelque chose de ce genre (à adapter
selon ce que tu veux


faire):


Sub SelectionPlage()
Dim CelluleDeDepart, CelluleDeFin As Range

Set CelluleDeDepart = Range("N16")
Set CelluleDeFin = Range("A65000").End(xlUp)

With Range(CelluleDeDepart.Address, CelluleDeFin.Address)
...
...
End With

Set CelluleDeDepart = Range("N20000").End(xlUp).Offset(1, 0)

With Range(CelluleDeDepart.Address, CelluleDeFin.Address)
...
...
End With
...
...
...
Set CelluleDeDepart = Nothing
Set CelluleDeFin = Nothing
End Sub


Denis


"Domi" a écrit dans le message news:
uksF9Y$
Bonsoir a tous,
un petit coup de main ?
With Range("N16:N" & Range("A65000").End(xlUp).Row)

Je voudrais dans ce petit bout de code remplacer la cellule de départ
(N16)



par la première cellule vide (en partant du bas) de la même colonne N.
Remplacer N16 par quelque chose comme ça :
Range("N20000").End(xlUp).Offset(1, 0)
Je n'arrive pas à trouver la syntaxe adhoc.

Merci
Domi