Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default save file using information from a cell

I have a .xls workbook called Data Load.
I have a sheet called Macro (holding my radio buttons assigned to macros).
I have another sheet called item_mass.

I want to keep my .xls workbook as Data Load.xls.
Within the macro I wanted to move/copy the item_mass sheet and then save it
as the name in cell D3 of the Macro sheet.

'Select Sheet
Sheets("item_mass").Select
'Copy to new workbook
' Sheets("item_mass").Copy
Dim fname
With ActiveWorkbook
fname = .Worksheets("Macro").Range("D3").Value & ".csv"
..SaveAs "C:\Documents and Settings\a01760\Desktop\Data_Loads\Prod
Trans\130\fname"
End With

ActiveWindow.Close
Sheets("Macro").Select

This is not working.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 257
Default save file using information from a cell

Looking at your code and ignoring what you say about it, what I see is this:
a) You get a file name (like "Data Load2", perhaps) from Macro!D3, and add
".csv" to it. Then b) you do a SaveAs, using "fname" as the file name.
Note: The file name is "fname", not "Data Load2.csv" (or whatever). That's
because you have "fnote" inside the quotes. You probably want that SaveAs to
look like this:

.SaveAs "C:\Documents and Settings\a01760\Desktop\" & _
"Data_Loads\Prod Trans\130\" & fname

Now, for the rest, you say you want to move/copy another sheet before you do
the SaveAs. But nothing in your code tries to do that; you select that
sheet, but the only other statement that refers to it is commented out, and
it wouldn't copy it TO anywhere, just "take a snapshot" so to speak. If you
want to copy that worksheet somewhere, we'll have to talk about the details a
bit more. Forget selecting it; what you need to copy it somewhere is a
statement something like this:

Sheets("item_mass").Copy After := Workbooks("W.xls").Worksheets("S2")

--- "Lynn" wrote:
I have a .xls workbook called Data Load.
I have a sheet called Macro (holding my radio buttons assigned to macros).
I have another sheet called item_mass.

I want to keep my .xls workbook as Data Load.xls.
Within the macro I wanted to move/copy the item_mass sheet and then save it
as the name in cell D3 of the Macro sheet.

'Select Sheet
Sheets("item_mass").Select
'Copy to new workbook
' Sheets("item_mass").Copy
Dim fname
With ActiveWorkbook
fname = .Worksheets("Macro").Range("D3").Value & ".csv"
.SaveAs "C:\Documents and Settings\a01760\Desktop\Data_Loads\Prod
Trans\130\fname"
End With

ActiveWindow.Close
Sheets("Macro").Select

This is not working.

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
Export to text file based on cell information Camron Excel Discussion (Misc queries) 0 July 24th 09 03:25 PM
How do I make an auto save when information is entered into a cell Option Button[_2_] Excel Discussion (Misc queries) 1 March 16th 09 07:36 PM
file name as specified cell when save as or save is clicked lynn Excel Programming 6 November 14th 08 06:23 PM
SAVE OR SAVE-AS with a file name derived from a cell on the spreadsheet... KLZA Excel Programming 0 July 31st 07 03:52 PM
Can I get Excel not to save a file if certain information is not i Sierra Coating Excel Worksheet Functions 4 July 29th 05 09:32 PM


All times are GMT +1. The time now is 05:50 PM.

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"