ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Rename active sheet (https://www.excelbanter.com/excel-programming/300360-rename-active-sheet.html)

lumaduc

Rename active sheet
 
I am trying to rename the active sheet from a cell in the sheet. Th
cell has a date. The cell has a date format of mm-dd-yy which is how
want the sheet to be renamed. When using Selection.Copy the dat
format is mm/dd/yy. So when i attempt to rename the sheet it cannot b
renamed since the date format has special characters.

Selection.Copy
ActiveSheet.Select
'ActiveSheet.Name = "01-05-04"
ActiveSheet.Name = Selection

ActiveSheet.Name = "01-05-04" is the correct format but cannot be use
since it will be in a Loop. Using Selection formats the date a
mm/dd/yy.

Is there a way to format Selection as mm-dd-yy

--
Message posted from http://www.ExcelForum.com


Ron de Bruin

Rename active sheet
 
Try this

ActiveSheet.Name = Format(Range("A1"), "mm-dd-yy")


--
Regards Ron de Bruin
http://www.rondebruin.nl


"lumaduc " wrote in message ...
I am trying to rename the active sheet from a cell in the sheet. The
cell has a date. The cell has a date format of mm-dd-yy which is how I
want the sheet to be renamed. When using Selection.Copy the date
format is mm/dd/yy. So when i attempt to rename the sheet it cannot be
renamed since the date format has special characters.

Selection.Copy
ActiveSheet.Select
'ActiveSheet.Name = "01-05-04"
ActiveSheet.Name = Selection

ActiveSheet.Name = "01-05-04" is the correct format but cannot be used
since it will be in a Loop. Using Selection formats the date as
mm/dd/yy.

Is there a way to format Selection as mm-dd-yy?


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com