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

Définir une variable

2 réponses
Avatar
Jean-Paul V
Bonjour à tous

J’ai ces 3 macros dans le code d’une feuille

Dim NOM As String
Sub MICI()
'raccourci i
ActiveCell.Name = "ICI"
End Sub
Sub MLA()
'raccourci l
ActiveCell.Name = "LA"
End Sub
Sub nommer()
'raccourci n
Range(Range("ICI"), Range("LA")).Select
Selection.Name = "NOM"
ActiveWorkbook.Names("ICI").Delete
ActiveWorkbook.Names("LA").Delete
End Sub

J’aimerais modifier la macro nommer de façon qu’elle pose d’abord la
question quel nom de champ nous voulons créer donc définir la variable NOM.

Comment modifier la macro nommer ?


@+ j’espère

--
Jean-Paul V

2 réponses

Avatar
JB
Bonjour,

Selection.Name = InputBox("Quel nom?")

ou

n = InputBox("Quel nom?")
If n <> "" Then Selection.Name = n

JB

On 9 fév, 09:42, Jean-Paul V
wrote:
Bonjour à tous

J'ai ces 3 macros dans le code d'une feuille

Dim NOM As String
Sub MICI()
'raccourci i
ActiveCell.Name = "ICI"
End Sub
Sub MLA()
'raccourci l
ActiveCell.Name = "LA"
End Sub
Sub nommer()
'raccourci n
Range(Range("ICI"), Range("LA")).Select
Selection.Name = "NOM"
ActiveWorkbook.Names("ICI").Delete
ActiveWorkbook.Names("LA").Delete
End Sub

J'aimerais modifier la macro nommer de façon qu'elle pose d'abord la
question quel nom de champ nous voulons créer donc définir la variable NOM.

Comment modifier la macro nommer ?

@+ j'espère

--
Jean-Paul V


Avatar
Jean-Paul V
Merci JB ça marche !

Et bravo pour votre fichier sur les fonctions matricielles trouvées dans
Excelabo !
C'est génial ! ! !

Bonne journée


--
Jean-Paul V


"JB" wrote:

Bonjour,

Selection.Name = InputBox("Quel nom?")

ou

n = InputBox("Quel nom?")
If n <> "" Then Selection.Name = n

JB

On 9 fév, 09:42, Jean-Paul V
wrote:
Bonjour à tous

J'ai ces 3 macros dans le code d'une feuille

Dim NOM As String
Sub MICI()
'raccourci i
ActiveCell.Name = "ICI"
End Sub
Sub MLA()
'raccourci l
ActiveCell.Name = "LA"
End Sub
Sub nommer()
'raccourci n
Range(Range("ICI"), Range("LA")).Select
Selection.Name = "NOM"
ActiveWorkbook.Names("ICI").Delete
ActiveWorkbook.Names("LA").Delete
End Sub

J'aimerais modifier la macro nommer de façon qu'elle pose d'abord la
question quel nom de champ nous voulons créer donc définir la variable NOM.

Comment modifier la macro nommer ?

@+ j'espère

--
Jean-Paul V