ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   auto name each new sheet based on cell value (https://www.excelbanter.com/excel-programming/430360-auto-name-each-new-sheet-based-cell-value.html)

J.W. Aldridge

auto name each new sheet based on cell value
 
Need each new sheet's name to be based on cell value.

Should look something like this (but this one doesnt work)


Private Sub Workbook_NewSheet(ByVal Sh As Object)
Dim Ws As Worksheet
Ws.Name = Ws.Range("e2").Text
End Sub

J.W. Aldridge

auto name each new sheet based on cell value
 
That's ok. Found one that works. But need to change the code to use
text...

This works....

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

But, since its a date, I need this to work (cant use /'s in sheet
name)

ActiveSheet.Name = Text(E2, "mm.dd.yy").Value


All times are GMT +1. The time now is 05:47 AM.

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