Range('a1').Name = ActiveSheet.Name
Public Sub toto()
Dim mafeuille As String
mafeuille = InputBox('Nom de feuille ?')
On Error GoTo pasbon
If mafeuille <> '' Then
Worksheets('feuil1').Copy After:=Worksheets('feuil1')
With ActiveSheet
.Name = mafeuille
.Range('a1').Name = .Name
End With
End If
On Error GoTo 0
Exit Sub
pasbon:
MsgBox 'y'a pas bon.'
End Sub
Salut Archi, Renato, Hervé et tout le forum
Autre solution par formule (déjà parue sur le forum)
=STXT(CELLULE('nomfichier':A1);TROUVE(']';CELLULE('nomfichhier';A1))+1;32)
Il faut que le fichier ait déjà été enregistré.
Il faut bien taper 'nomfichier' et non pas le nom du fichier.
Voilou
Public Sub toto()
Dim mafeuille As String
mafeuille = InputBox('Nom de feuille ?')
On Error GoTo pasbon
If mafeuille <> '' Then
Worksheets('feuil1').Copy After:=Worksheets('feuil1')
With ActiveSheet
.Name = mafeuille
.Range('a1').Name = .Name
End With
End If
On Error GoTo 0
Exit Sub
pasbon:
MsgBox 'y'a pas bon.'
End Sub