Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to change the name of an excel worksheet and create a new
filename from one of the cells? The source cell is a name in format: Surname, Firstname Thanks for your help MR |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi RisingStar,
Try this: - Open your workbook; - Right click on tab sheet; - Click View Code command; - Insert the code below; - Now inserting a string on A1 cell the file name will be changed as. Private Sub Worksheet_Change(ByVal Target As Range) Dim OldFileName As String Dim NewFileName As String If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub NewFileName = Range("A1").Value NewFileName = Replace(NewFileName, ", ", "_") OldFileName = ThisWorkbook.FullName ThisWorkbook.SaveAs ThisWorkbook.Path & "\" & NewFileName & ".xls" Kill OldFileName End Sub HTH --- Orlando Magalhães Filho (So that you get best and rapid solution and all may benefit from the discussion, please reply within the newsgroup, not in email) "RisingStar" escreveu na mensagem ... Is it possible to change the name of an excel worksheet and create a new filename from one of the cells? The source cell is a name in format: Surname, Firstname Thanks for your help MR |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Reverse naming of file | New Users to Excel | |||
Auto file naming | Excel Discussion (Misc queries) | |||
Importing Word file and Naming of Worksheets | Excel Worksheet Functions | |||
File naming conventions | Excel Discussion (Misc queries) | |||
naming .xls file based on a cell in excel | Excel Discussion (Misc queries) |