A voir également:
- [VBA] nommer une partie de colonne
- Déplacer une colonne excel - Guide
- Nommez une application d'appel vidéo ou de visioconférence - Guide
- Trier une colonne excel - Guide
- Colonne word - Guide
- Formule somme excel colonne - Guide
3 réponses
Sub Macro1()
Dim Header As Range
Dim Footer As Range
Dim Cellule As Range
Set Header = Range("A4:D4")
Set Footer = Range("A14:D14")
Dim diff As Integer
Dim colonne As Range
Dim test As Range
Dim yo As Range
Dim nom As String
Dim repere As Integer
For Each Cellule In Header
If Not IsEmpty(Cellule) Then
repere = 0
nom = Cellule.Value()
Do
repere = repere + 1
Set test = Cells(Cellule.Row + repere, Cellule.Column)
Set yo = Cells(Cellule.Row + repere + 1, Cellule.Column)
Set colonne = Union(Cellule, test)
Loop While Application.Intersect(yo, Footer) Is Nothing
colonne.Select
ActiveWorkbook.Names.Add Name:=nom, RefersTo:=Selection.Address
End If
Next Cellule
End Sub
Dim Header As Range
Dim Footer As Range
Dim Cellule As Range
Set Header = Range("A4:D4")
Set Footer = Range("A14:D14")
Dim diff As Integer
Dim colonne As Range
Dim test As Range
Dim yo As Range
Dim nom As String
Dim repere As Integer
For Each Cellule In Header
If Not IsEmpty(Cellule) Then
repere = 0
nom = Cellule.Value()
Do
repere = repere + 1
Set test = Cells(Cellule.Row + repere, Cellule.Column)
Set yo = Cells(Cellule.Row + repere + 1, Cellule.Column)
Set colonne = Union(Cellule, test)
Loop While Application.Intersect(yo, Footer) Is Nothing
colonne.Select
ActiveWorkbook.Names.Add Name:=nom, RefersTo:=Selection.Address
End If
Next Cellule
End Sub