ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Naming Worksheets With Leading Zeros (https://www.excelbanter.com/excel-programming/294652-naming-worksheets-leading-zeros.html)

Mike Taylor

Naming Worksheets With Leading Zeros
 
Cell "A1" contains a number, say "10". The number format of that cell
is a custom number format ("000"). The value is displayed as "010" in
cell "A1".

Is there any code that will name the wrksht using the number in cell
"A1" and display that name on the tab as "010" rather than "10"? TIA

Mike Taylor

Frank Kabel

Naming Worksheets With Leading Zeros
 
Hi
try something like
activesheet.name = format(Range("A1").value,"000")

--
Regards
Frank Kabel
Frankfurt, Germany


Mike Taylor wrote:
Cell "A1" contains a number, say "10". The number format of that cell
is a custom number format ("000"). The value is displayed as "010" in
cell "A1".

Is there any code that will name the wrksht using the number in cell
"A1" and display that name on the tab as "010" rather than "10"? TIA

Mike Taylor




All times are GMT +1. The time now is 05:43 PM.

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