ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   renaming sheets (https://www.excelbanter.com/excel-programming/360116-renaming-sheets.html)

Kjeldc[_2_]

renaming sheets
 
How do I rename a worksheet like this:
Original name + (Year-1)
I want to save some worksheets when a new year starts and use the old name
again on a new empty sheet

somethinglikeant

renaming sheets
 
Sub RenameSheet()
x = WorksheetFunction.Text(Now(), "YYYY") - 1
ActiveSheet.Name = ActiveSheet.Name & " " & x
End Sub

This code performs this operation on the current activesheet

somethinglikeant


Ron de Bruin

renaming sheets
 
Hi Kjeldc

Try this
ActiveSheet.Name = ActiveSheet.Name & " " & Year(Date) - 1


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


"Kjeldc" wrote in message ...
How do I rename a worksheet like this:
Original name + (Year-1)
I want to save some worksheets when a new year starts and use the old name
again on a new empty sheet




Kjeldc[_2_]

renaming sheets
 
Thank you, both of you. Just what I wanted ;-)

"Ron de Bruin" skrev:

Hi Kjeldc

Try this
ActiveSheet.Name = ActiveSheet.Name & " " & Year(Date) - 1


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


"Kjeldc" wrote in message ...
How do I rename a worksheet like this:
Original name + (Year-1)
I want to save some worksheets when a new year starts and use the old name
again on a new empty sheet





wal50

renaming sheets
 
Helpful as always.
Thanks,
wal50

"Ron de Bruin" wrote:

Hi Kjeldc

Try this
ActiveSheet.Name = ActiveSheet.Name & " " & Year(Date) - 1


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


"Kjeldc" wrote in message ...
How do I rename a worksheet like this:
Original name + (Year-1)
I want to save some worksheets when a new year starts and use the old name
again on a new empty sheet






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

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