ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing a sheet name to the current date (https://www.excelbanter.com/excel-programming/356115-changing-sheet-name-current-date.html)

Reddist

Changing a sheet name to the current date
 
Hi. I am trying to rename a new sheet to the current date, using the
"15-Mar-06" format, but I keep getting an error whenever I hit this line of
code:

ActiveSheet.Name = ActiveSheet.Range("H3").Value

....where H3.value is the current date. I think its seeing the "/"s in the
date and not wanting to accept the value, even though I have a line above
where I change the format of the date in that H3 cell. Name = Date doesn't
work either, I think for the same reason.

Any ideas?

thanks oodles!

Eric White[_2_]

Changing a sheet name to the current date
 
Try this:

ActiveSheet.Name = Format(ActiveSheet.Range("H3").Value,"dd-mmm-yy")



"Reddist" wrote:

Hi. I am trying to rename a new sheet to the current date, using the
"15-Mar-06" format, but I keep getting an error whenever I hit this line of
code:

ActiveSheet.Name = ActiveSheet.Range("H3").Value

...where H3.value is the current date. I think its seeing the "/"s in the
date and not wanting to accept the value, even though I have a line above
where I change the format of the date in that H3 cell. Name = Date doesn't
work either, I think for the same reason.

Any ideas?

thanks oodles!


Reddist

Changing a sheet name to the current date
 
That works perfectly. Thanks!

"Eric White" wrote:

Try this:

ActiveSheet.Name = Format(ActiveSheet.Range("H3").Value,"dd-mmm-yy")



"Reddist" wrote:

Hi. I am trying to rename a new sheet to the current date, using the
"15-Mar-06" format, but I keep getting an error whenever I hit this line of
code:

ActiveSheet.Name = ActiveSheet.Range("H3").Value

...where H3.value is the current date. I think its seeing the "/"s in the
date and not wanting to accept the value, even though I have a line above
where I change the format of the date in that H3 cell. Name = Date doesn't
work either, I think for the same reason.

Any ideas?

thanks oodles!



All times are GMT +1. The time now is 07:02 PM.

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