Is there a way to name worksheets after Cells?

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
Hi ness222:

Welcome to the Board!

If I understand you correctly, Yes! -- you can put the filename in a cell, and then in the Workbook_BeforeSave event, have the procedure read the file name from the cell before saving it.

Regards!
Yogi Anand
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
Sub SaveByCell()
Dim sFileName As String
'Cell A1 has the new file name.
sFileName = Sheets("Sheet1").Range("A1")

'If Cell A1 is Blank do not save.
If sFileName = "" Then Exit Sub

'The Drive:Path & the file name in cell A1.
ThisWorkbook.SaveAs "C:MyFilesExcelData" & sFileName
End Sub

Hope this helps?
Note: This is standard module code and you must code the drive and folder for this to work! JSW
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
Sub myCellSheet()
' Standard module code.

' Add a sheet and name it the value of cell A1 from Sheet1.
Sheets.Add.Name = Sheets("Sheet1").Range("A1").Value

' Option, only rename the active sheet a new name,
' found in the cell A1 on Sheet1.
' Un-comment below and comment above to use!
'ActiveSheet.Name = Sheets("Sheet1").Range("A1").Value

' Option, This will re-name the current sheet to a name
' of your choice, by Input Box.
' Un-comment below and comment above to use!
'Dim MySheet
'ActiveSheet.Select
'MySheet = Application.InputBox(prompt:="Rename the current sheet to:", Type:=2)
'ActiveSheet.Name = MySheet
'Range("A1").Select

End Sub

Hope these options help. JSW
 

ness222

New Member
Joined
Nov 1, 2002
Messages
9
How would i make it so i can change the value in A1 and then it would update?
 

ness222

New Member
Joined
Nov 1, 2002
Messages
9
nevermind i made it so it named the worksheet after a cell in itself and it updats automatically
 

Forum statistics

Threads
1,144,120
Messages
5,722,596
Members
422,447
Latest member
knopp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top