Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving worksheets as filenames


Hi everyone, this sort of relates to an earlier message, but I have
tried to simplfy what I am asking about (more for my benefit than
yours!) :)

I have a spreadsheet with a number of worksheets, eg: Name1, Name2,
Name3.

These names are held in worksheet "AllNames" between cells A1:A10

What I would like to do is loop thru the list of names in "AllNames"
A1:A10 and for each inidividual worksheet save the relevant worksheet
as a new workbook file in the same filepath but a folder called
"Names". If possible with the date it was saved hard coded in.

Is this possible??
If so, all help gratefully received

Love Amy xx


--
AmyTaylor
------------------------------------------------------------------------
AmyTaylor's Profile: http://www.excelforum.com/member.php...o&userid=20970
View this thread: http://www.excelforum.com/showthread...hreadid=536051

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Saving worksheets as filenames

For Each cell In Range("AllNames")
worksheets(cell.Value).Copy
Activeworkbook.SaveAs "Names\" & _
Format(Date,"yyy-mm-dd hh:mm:ss") & ".xls"
Next cell

AmyTaylor wrote:
Hi everyone, this sort of relates to an earlier message, but I have
tried to simplfy what I am asking about (more for my benefit than
yours!) :)

I have a spreadsheet with a number of worksheets, eg: Name1, Name2,
Name3.

These names are held in worksheet "AllNames" between cells A1:A10

What I would like to do is loop thru the list of names in "AllNames"
A1:A10 and for each inidividual worksheet save the relevant worksheet
as a new workbook file in the same filepath but a folder called
"Names". If possible with the date it was saved hard coded in.

Is this possible??
If so, all help gratefully received

Love Amy xx



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Saving worksheets as filenames

Sub SaveSheetNames()
Dim i As Integer
Dim File1 As Workbook
Dim Path1 As String
Set File1 = ActiveWorkbook
Sheets("AllNames").Activate
Path1 = File1.Path & "\Names"
If Not FSO.FolderExists(Path1) Then FSO.CreateFolder (Path1)
For i = 1 To 10
Sheets(Cells(i, 1).Value).Copy
ActiveWorkbook.SaveAs Filename:=Path1 & "\" & Cells(i, 1).Value &
Replace(Date, "/", "-") _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close False
File1.Activate
Sheets("AllNames").Activate
Next
End Sub

There's my 2 minute attempt at it. Note there is NO error checking so
make sure that the AllNames sheet range A1:A10 all contain valid sheet
names

Die_Another_Day

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
All worksheets in document are not saving! Christine Excel Discussion (Misc queries) 1 April 23rd 10 03:41 PM
Saving Excel worksheets bms Excel Discussion (Misc queries) 0 October 23rd 07 08:36 PM
Saving worksheets Tkaminski Excel Worksheet Functions 1 April 18th 05 03:49 PM
Saving Worksheets D.Parker Excel Programming 2 March 29th 05 05:25 AM
Saving worksheets without Auto_Open Bowbender Excel Programming 4 May 18th 04 06:47 PM


All times are GMT +1. The time now is 03:07 AM.

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

About Us

"It's about Microsoft Excel"