Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Naming File from a Cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Naming File from a Cell

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reverse naming of file kenppy New Users to Excel 2 March 5th 10 07:02 PM
Auto file naming Jacquesvv Excel Discussion (Misc queries) 1 June 23rd 09 02:57 PM
Importing Word file and Naming of Worksheets James8309 Excel Worksheet Functions 0 May 22nd 08 07:51 AM
File naming conventions gidget Excel Discussion (Misc queries) 7 November 15th 05 02:15 PM
naming .xls file based on a cell in excel lsu-i-like Excel Discussion (Misc queries) 1 June 24th 05 09:44 PM


All times are GMT +1. The time now is 10:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"