bonjour à tous et excellente nouvelle année 2009 !
la macro suivante permet de nommer des colonnes à partir d'un nom situé sur
une ligne donnée :
Sub Nommer_Colonnes_Selon_Ligne_n()
Dim nom As String
Set f = Worksheets("onglet")
For i = 42 To 53
If Left(Cells(3, i), 1) = "V" Then
nom = Cells(244, i)
Else
nom = "_" & Cells(244, i)
End If
Set ici = f.Columns(i)
ActiveWorkbook.Names.Add Name:=nom, RefersTo:=ici
Next i
End Sub
Comment adapter la macro pour faire en sorte que le nombre de lignes soit
également indiqué (par exemple le nom ferait référence à AP244:AP5000 et non
plus AP:AP)
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Daniel.C
Bonjour. Essaie :
Sub Nommer_Colonnes_Selon_Ligne_n() Dim nom As String Set f = Worksheets("onglet") For i = 42 To 53 If Left(Cells(3, i), 1) = "V" Then nom = Cells(244, i) Else nom = "_" & Cells(244, i)
End If f.Range(Cells(244, i), Cells(5000, i)).Name = nom Next i End Sub
Cordialement. Daniel
bonjour à tous et excellente nouvelle année 2009 !
la macro suivante permet de nommer des colonnes à partir d'un nom situé sur une ligne donnée :
Sub Nommer_Colonnes_Selon_Ligne_n() Dim nom As String
Set f = Worksheets("onglet") For i = 42 To 53 If Left(Cells(3, i), 1) = "V" Then nom = Cells(244, i) Else nom = "_" & Cells(244, i)
End If Set ici = f.Columns(i) ActiveWorkbook.Names.Add Name:=nom, RefersTo:=ici Next i End Sub
Comment adapter la macro pour faire en sorte que le nombre de lignes soit également indiqué (par exemple le nom ferait référence à AP244:AP5000 et non plus AP:AP)
Merci d'avance !
Bien cordialement,
Vincent_C
Bonjour.
Essaie :
Sub Nommer_Colonnes_Selon_Ligne_n()
Dim nom As String
Set f = Worksheets("onglet")
For i = 42 To 53
If Left(Cells(3, i), 1) = "V" Then
nom = Cells(244, i)
Else
nom = "_" & Cells(244, i)
End If
f.Range(Cells(244, i), Cells(5000, i)).Name = nom
Next i
End Sub
Cordialement.
Daniel
bonjour à tous et excellente nouvelle année 2009 !
la macro suivante permet de nommer des colonnes à partir d'un nom situé sur
une ligne donnée :
Sub Nommer_Colonnes_Selon_Ligne_n()
Dim nom As String
Set f = Worksheets("onglet")
For i = 42 To 53
If Left(Cells(3, i), 1) = "V" Then
nom = Cells(244, i)
Else
nom = "_" & Cells(244, i)
End If
Set ici = f.Columns(i)
ActiveWorkbook.Names.Add Name:=nom, RefersTo:=ici
Next i
End Sub
Comment adapter la macro pour faire en sorte que le nombre de lignes soit
également indiqué (par exemple le nom ferait référence à AP244:AP5000 et non
plus AP:AP)
Sub Nommer_Colonnes_Selon_Ligne_n() Dim nom As String Set f = Worksheets("onglet") For i = 42 To 53 If Left(Cells(3, i), 1) = "V" Then nom = Cells(244, i) Else nom = "_" & Cells(244, i)
End If f.Range(Cells(244, i), Cells(5000, i)).Name = nom Next i End Sub
Cordialement. Daniel
bonjour à tous et excellente nouvelle année 2009 !
la macro suivante permet de nommer des colonnes à partir d'un nom situé sur une ligne donnée :
Sub Nommer_Colonnes_Selon_Ligne_n() Dim nom As String
Set f = Worksheets("onglet") For i = 42 To 53 If Left(Cells(3, i), 1) = "V" Then nom = Cells(244, i) Else nom = "_" & Cells(244, i)
End If Set ici = f.Columns(i) ActiveWorkbook.Names.Add Name:=nom, RefersTo:=ici Next i End Sub
Comment adapter la macro pour faire en sorte que le nombre de lignes soit également indiqué (par exemple le nom ferait référence à AP244:AP5000 et non plus AP:AP)
Merci d'avance !
Bien cordialement,
Vincent_C
Vincent_C
Vraiment super, ça marche impeccable. Merci beaucoup et très bonne journée !
Bien cordialement,
Vincent_C
"Daniel.C" a écrit :
Bonjour. Essaie :
Sub Nommer_Colonnes_Selon_Ligne_n() Dim nom As String Set f = Worksheets("onglet") For i = 42 To 53 If Left(Cells(3, i), 1) = "V" Then nom = Cells(244, i) Else nom = "_" & Cells(244, i)
End If f.Range(Cells(244, i), Cells(5000, i)).Name = nom Next i End Sub
Cordialement. Daniel
> bonjour à tous et excellente nouvelle année 2009 ! > > la macro suivante permet de nommer des colonnes à partir d'un nom situé sur > une ligne donnée : > > > Sub Nommer_Colonnes_Selon_Ligne_n() > Dim nom As String > > Set f = Worksheets("onglet") > For i = 42 To 53 > If Left(Cells(3, i), 1) = "V" Then > nom = Cells(244, i) > Else > nom = "_" & Cells(244, i) > > End If > Set ici = f.Columns(i) > ActiveWorkbook.Names.Add Name:=nom, RefersTo:=ici > Next i > End Sub > > Comment adapter la macro pour faire en sorte que le nombre de lignes soit > également indiqué (par exemple le nom ferait référence à AP244:AP5000 et non > plus AP:AP) > > Merci d'avance ! > > Bien cordialement, > > Vincent_C
Vraiment super, ça marche impeccable. Merci beaucoup et très bonne journée !
Bien cordialement,
Vincent_C
"Daniel.C" a écrit :
Bonjour.
Essaie :
Sub Nommer_Colonnes_Selon_Ligne_n()
Dim nom As String
Set f = Worksheets("onglet")
For i = 42 To 53
If Left(Cells(3, i), 1) = "V" Then
nom = Cells(244, i)
Else
nom = "_" & Cells(244, i)
End If
f.Range(Cells(244, i), Cells(5000, i)).Name = nom
Next i
End Sub
Cordialement.
Daniel
> bonjour à tous et excellente nouvelle année 2009 !
>
> la macro suivante permet de nommer des colonnes à partir d'un nom situé sur
> une ligne donnée :
>
>
> Sub Nommer_Colonnes_Selon_Ligne_n()
> Dim nom As String
>
> Set f = Worksheets("onglet")
> For i = 42 To 53
> If Left(Cells(3, i), 1) = "V" Then
> nom = Cells(244, i)
> Else
> nom = "_" & Cells(244, i)
>
> End If
> Set ici = f.Columns(i)
> ActiveWorkbook.Names.Add Name:=nom, RefersTo:=ici
> Next i
> End Sub
>
> Comment adapter la macro pour faire en sorte que le nombre de lignes soit
> également indiqué (par exemple le nom ferait référence à AP244:AP5000 et non
> plus AP:AP)
>
> Merci d'avance !
>
> Bien cordialement,
>
> Vincent_C
Vraiment super, ça marche impeccable. Merci beaucoup et très bonne journée !
Bien cordialement,
Vincent_C
"Daniel.C" a écrit :
Bonjour. Essaie :
Sub Nommer_Colonnes_Selon_Ligne_n() Dim nom As String Set f = Worksheets("onglet") For i = 42 To 53 If Left(Cells(3, i), 1) = "V" Then nom = Cells(244, i) Else nom = "_" & Cells(244, i)
End If f.Range(Cells(244, i), Cells(5000, i)).Name = nom Next i End Sub
Cordialement. Daniel
> bonjour à tous et excellente nouvelle année 2009 ! > > la macro suivante permet de nommer des colonnes à partir d'un nom situé sur > une ligne donnée : > > > Sub Nommer_Colonnes_Selon_Ligne_n() > Dim nom As String > > Set f = Worksheets("onglet") > For i = 42 To 53 > If Left(Cells(3, i), 1) = "V" Then > nom = Cells(244, i) > Else > nom = "_" & Cells(244, i) > > End If > Set ici = f.Columns(i) > ActiveWorkbook.Names.Add Name:=nom, RefersTo:=ici > Next i > End Sub > > Comment adapter la macro pour faire en sorte que le nombre de lignes soit > également indiqué (par exemple le nom ferait référence à AP244:AP5000 et non > plus AP:AP) > > Merci d'avance ! > > Bien cordialement, > > Vincent_C