Thread: Rename Tab
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Rename Tab

Kerry,

Try. The date value by default will have \ or / which is not an acceptable
chr..

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

If this post helps click Yes
---------------
Jacob Skaria


"Kerry" wrote:

Hi Jacob,
I put a number in another cell and referenced to that cell and it worked so
it appears that the problem is with cell A81. The formula in cell A81 is =A80
and is formatted to provide a date e.g. 17-Jun-09. Cell A80 is a numeric date
e.g. 39981. Is the VB code reading the formula in this case or is there a
problem with the formatting?

Thanks
--
Kerry


"Jacob Skaria" wrote:

Dont find any issue with your code. Make sure Range("A81") is not empty or a
sheet already exist by the name. Suggest you to print at last.


If this post helps click Yes
---------------
Jacob Skaria


"Kerry" wrote:

Hi Everyone,
By pressing one button I am trying to print out the timesheet, copy and save
as a new sheet and then rename the tab from the formula in cell A81. It is
hanging at ActiveSheet.Name = Range("A81").Value. Any suggestions would be
appreciated.

Sheets("Timesheet").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveSheet.Copy after:=ActiveSheet
ActiveSheet.Name = Range("A81").Value
Sheets("Timesheet").Select
--
Kerry