Excel - Macro Tri - Key1 = colonne de la cellule active
AlainDP
Messages postés
1
Statut
Membre
-
AlainDP -
AlainDP -
Bonjour,
Dans la partie du code suivant:
Application.Goto Reference:="ChampTri"
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("J10:J25") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Feuil1").Sort
.SetRange Range("ChampTri")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
comment remplacer Range("J10:J25") par la colonne de la cellule active ?
Merci d'avance de votre réponse.
Dans la partie du code suivant:
Application.Goto Reference:="ChampTri"
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("J10:J25") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Feuil1").Sort
.SetRange Range("ChampTri")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
comment remplacer Range("J10:J25") par la colonne de la cellule active ?
Merci d'avance de votre réponse.
3 réponses
-
Bonjour,
Mettre ce code dans la feuille concernée:
Option Explicit Private Sub Worksheet_SelectionChange(ByVal Target As Range) MsgBox Split(ActiveCell.Address, "$")(1) End Sub
Tu remplaceras le MsgBox par une variable que tu déclareras Public
Ensuite:
Public mavariable As String Range(mavariable & "10:" & mavariable & "25")
Voilà
-
Bonjour à tous les deux
Un exemple
http://www.cjoint.com/c/FCstvpWRXG5
Cdlmnt -