View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Naming a Sheet with a function

You probably have illegal characters in your date format (e.g., "/")

Try

ActiveSheet.Name = Format(Date, "dd-mmm-yyyy")

substitute your desired date format (with legal characters)



In article ,
MónicaM wrote:

I want to put in the sheet name tab the actual date. I have tried the
following macro but it does not work:
Sub nombrar()

Dim fecha As String

fecha = Date
ActiveCell.Value = fecha ‘this is only for testing that fecha is
a string with the date
ActiveSheet.Name = fecha

End Sub

I get an error in the last line. If I put fecha between quotes I get
the name fecha of course, insted of his value