Save File By Cell Entry And Keep Macros

Apr 2, 2009

would like to save a spreadsheet with the contents of a cell as the name. My problem is that I have several macros in the workbook and if I change the name of the file when I save, it won't run the macros when I reopen because the filename has changed. It presents me with an error saying it can't find the macro.

View 9 Replies


ADVERTISEMENT

Macros To Save Worksheet Based On Cell Reference

Feb 12, 2009

I have a macros ( code inserted ) as you can see in my code the macros save the workbook in any file name you chose just by changing the any filename option.

I would like this to be changed so that it saves based on a cell reference, say i has a name in lets say B10 i would like it to save as the name in B10.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
Dim bk1 As Workbook
Dim bk As Workbook
Dim myfilename As String

View 9 Replies View Related

Save Each Worksheet As PDF File And Name Each File Based On Cell Value In Each Sheet

Jul 10, 2014

I have a Workbook that already has a macro in it that will generate multiple sheets based on certain criteria.

For each of these newly generated sheets (numbered 1-6 in the attached example), I need to be able save each of them to a PDF file based on a unique name contained in a certain cell (in this case, each named is referenced in cell Q1 of each sheet). As such, I should end up with 6 pdfs based on the attached sample files.

The PDFs would ideally need to be landscaped and should be just 1 page per sheet.

In my attached sample workbook, you'll notice that I have a "PracticePrint" macro that doesn't quite get the job done. One other criteria involves not printing any sheet with the characters "1010" in it (my PracticePrint macro is setup to do that, but it fails to do much else).

View 1 Replies View Related

Macro To Save File - Save Name From Cell Containing Date Using Different Date Formatting

Aug 15, 2014

I am trying to create a macro to run from a form button, within a report, to save a file to a variable file path and name depending on the date value in cell B5.

The format of B5 looks like - 13/08/2014 16:39

The file path has folders for each year in format "yyyy" with each year having sub folders for each month in format "mm".

The file name is just the date only and is formatted "dd.mm.yy" e.g. 13.08.14

I have tried the code below in various permutations but always end up with an error - Method 'SaveAs' of object '_Workbook' failed.

[Code] ......

View 3 Replies View Related

Save File Name Using Cell Value

Oct 16, 2008

I am trying to create a macro which will save the file and take the file name from cell values eg if cell A1 = "488" and Cell B1= "Buyers" when saved the file name would be 488_Buyers.

Can anyone point me in the right direction?

View 7 Replies View Related

File Save With The Value In Cell A2

Oct 31, 2008

I have a excel workbook witha table and a chart.

I want to make him save with the name that it will be writen in the cell A2.

View 9 Replies View Related

Macro To Save Workbook By Referencing Cell In Another Workbook For File Name And File Path

Mar 21, 2013

I have got a master workbook and I have written macro to copy and paste data on another workbook. write a macro to save the new workbook to a file path with a file name where both file name and path are stored in master workbook sheet...

View 5 Replies View Related

Save AS File Name As Cell Contents

Oct 6, 2009

I would like to be able to open a template and save the contents of cell B19 as the file name.

Can I do this so i don't have to press a button to run the macro. I have only done one macro previously and that was with the help of people on this forum so don't get to technical.

If possible I would like to be able to save it on the server X:
eportsoffender PDF's

View 10 Replies View Related

Save A Cell As A Text File

Dec 3, 2007

Could any Excel wiz out there tell me whether the following is possible, and if so what would be the VB code to do it?

I would like a macro that will save the contents of cell A2 in a text file, with file name from cell A1, then move the cursor down to the next row, and repeat the process until reaching the last row of data.

The end result would be a stack of text files, each containing the data from a single cell in the spreadsheet.

e.g.
001.txt (containing the contents of cell A2)
002.txt (containing the contents of cell B2)
003.txt (containing the contents of cell C2)
...etc.

This is for a multi lingual dictionary so the text files would have to be unicode as well.

View 12 Replies View Related

Save File With Cell Supplied Name

Mar 10, 2009

I have a file where cell A1 is the name of the file along with B1 and C1 which provide the versions and variations:-

A1 - Sales Analysis
B1 - Version 2
C1 - Variation C

Is it possible to have a macro driven off a button button which will save the file as (current path to current folder) and then Sales Analysis Version 2 Variation C

View 8 Replies View Related

Save Just A Cell Value As Text File?

Oct 28, 2012

By using a macro is it possible to save just a cell value as a txt file?

This is part of a Forex system I am building using excel.

There will be 28 pairs and a total of 168 buttons. Each button will be assigned a cell which will hold the information for that trade.

I am looking for a macro that will save just the cell value as trade.txt

View 4 Replies View Related

Save A File With A Date Taken From A Cell

Jan 26, 2007

Is it possible to save a file with a date taken from a cell? For example:

I have an Excel file opened, in the cell A1 there is a date: 12.04.2003 (or any other date format). I want an Excel to save this document, but after I check the date of creation (modification) of the file under Windows, I want to receive the result 12.04.2004 (or any other, that was in the cell "A1" before pressing SAVE button).

I imagine, that there would have to be some external script running, that would change the system date for a moment, just after detection of pressing SAVE command.

View 9 Replies View Related

Save As File Name With A Cell Value As The Folder

Nov 26, 2007

i currently have a macro on my sheet which when the file opens will chaneg a cell value by +1 and save the new worksheet as that value.

What i would like is for the new worksheet to automatically save in a new folder relevant to another cell value. So i can save the sheets in job no order.

Can't seem to get it to work....

Here is a copy of my macro so far:

Sub SequentialNumber()
Const InitialValue = 1
Const increment = 1
Const prefix = ""
Const suffix = ""

Dim existSN As Boolean
Dim existMF As Boolean
Dim master As Boolean
Dim cdp As DocumentProperty
Dim SeqNumber As Long
Dim FSName As Variant

existSN = False
existMF = False
master = False.........

View 9 Replies View Related

Force File Name From Cell On Save As

May 1, 2009

When you click File>Save As, you get a save as window that shows the current file name to "Save As"

I would like to create a macro that shows the values in a couple of cells (lets use Range("A1") & Range("B2")) instead of the current file name.

View 4 Replies View Related

Save File As Cell Value (Date)

Jan 4, 2008

I'm working on creating a computerised invoicing system for where I work, and right now I'm creating a Day Book file.

I want the name of the file to simply be the date which it was created, in YYYYMMDD format. However, I keep getting the error message and am not sure what has gone wrong.

Please note that in the day book template, cell F1 contains the formula

=TEXT(E1,"yyyymmdd")

which may be useful to know in the later part of the code.

from the code below?

Private Sub DayBook_Click()

Select Case MsgBox("Proceed? (Ensure that a Day Book has not already been created)", vbYesNo Or vbQuestion Or vbDefaultButton1, "Day Book Creation")
Case vbYes
Dim strName As String

'copy today's date from invoice template
Range("H4").Select
Application.CutCopyMode = False
Selection.Copy

View 3 Replies View Related

Save Excel File As Another File Using Current Date As Part Of File Name

Oct 10, 2011

VBA coding for automatically saving an excel file as another file using the current date as part of the file name together with "32ga" as a constant add-in. I also what this macro to run at a particular time of the day let say 00:20hrs. The excel file i want to save as is always open . It has data that changes every 24-hrs.

View 1 Replies View Related

Save File As Pdf Based On Cell Reference A4?

Mar 6, 2014

I want to save my file as a pdf based on cell reference A4.

This is what i have

[Code] ....

View 2 Replies View Related

Automatically Produce Save As File Name By Value In A Cell

Mar 21, 2009

I would like excel to automatically suggest the save as file name and location for my workbook when I click the save, save as or close options. The file name should be a combination of values in cells A1 and A2 of Sheet1. The location should be a folder named "Bill" in C:/My Documents. I think I can do it with a beforesave code but I am new to vba.

View 13 Replies View Related

Automatically Save File Name From Cell Data

Jul 22, 2013

How to click a button to automatically combine a few cell data and save it as the file name ?

The file name i want to save, is in this method.

( Date 2013-07-22 ) + ( Cheque No UOB000000 ) + ( ReceiverName ) + ( InvoiceNo L123456 ) + ( Payment Voucher Code ) + ( Amounts $1111111 )
______V5___________________E17___________________D11________________O9______________Add word ( PV )_____________W16

Sample File name : 2013-07-22_UOB000000_TransAuto_Inv778899_PV_$$$$$$$

I tried to add this code : FName = ActiveWorkbook.Sheets("Payment Voucher").Range =("V5&"_"&E17&"_"&D11&"-"&O9&"_"&"PV"&"_"&W16")

But getting error.

Than i tried to group all the cell data into cell (E11) and than select as range (E11), but when i tried to group it, the beginning the file name instead of i want it to be the date 2013-07-22_UOB........ it become 41113_UOB............

View 5 Replies View Related

Save A File Dependant On Cell Reference

May 21, 2007

i have a order form that is customer dependant. the cust name on the form is manually entered by the user within a msg box. i have specific cusotmer folders on a shared machines C drive where i would like to save these excel docs to.

i understand that the cust name must match the name of the file and there needs to be a way to save those that do not have specific folder matching what was entered as the customer name.

the overall goal is to have the file name saved as CustomerNameDeliveryDateInvoiceNumber.xls where CustName is from cell "M3", delivery date is "Q7" and InvoiceNumber is "Q1".

Sub OrderFormSave()

Dim strCustFileName As String

savefile = "\SrSharedDocsCSPSharedFILESCustomerOrderForms & strCustFileName & "

ActiveWorkbook.SaveCopyAs savefile

End Sub

View 9 Replies View Related

Macro To Save Workbook/File As Cell Value

Sep 15, 2006

I need to be able to save a workbook by running a marco and it save the file automatically by pulling what ever the value of cell A1 is.

Ex: I want to run the macro and it save my excel workbook in C:Documents as (Value of Cell A1) What code would you put into Visual Basic.

View 3 Replies View Related

Get File From Cell Values And Save In Another Folder

Mar 2, 2007

I want to add the columns in the attached sheet...any 4,say A,C,D and F.....as follows,if the number in the cell is less than .8,I want use 1 in the sum,otherwise zero. I would like to do this in 1 column if possible. in the attached sheet,I have filled in manually the answer in column L....Thus row 1 contained no numbers less than .8 in the selected columns,where as row 8 had all four numbers less than .8.

View 6 Replies View Related

Save File With Date From Cell Appended To Name

Jun 5, 2008

I have this script that runs. and checks to see if anything is in C1. If something is, it saves...if it doesn't, it fails and does not save.

Sub SaveAsCell()
Dim strName As String

On Error Goto InvalidName
strName = Sheet1. Range("C1")
ActiveWorkbook.SaveAs strName

Exit Sub
InvalidName: MsgBox "The text: " & strName & _
" is not a valid file name.", vbCritical, "TitleBar Name" ........

View 9 Replies View Related

Excel 2010 :: Save Open Worksheet To File And Include Date Of Save?

Mar 11, 2014

am using Excel 2010 and having issues trying to save a worksheet to a specified file location with the save date....

I have tried several posts form this forum and elsewhere and can't seem to get the macro to do what I want.....

I want to save a 'worksheet' from an open workbook that I use for updating information to the same file path as the workbook with the date the file saved...

View 6 Replies View Related

Excel Save As Should Default File Save Type To XLSX Using VBA

Aug 21, 2012

What I am trying to do is that I have an excel file with macros and it is a read-only file. In order for the user to save, I want them to only be able to save as a .xlsx file as it disables all macros. If for whatever reason, the user wants to save the file as another .xlsm file, they should be allowed but before they save, a "are you sure you want to save as .xlsm?" message should pop up.

All the options in the save as box should still be available in case they want to save in that particular format. Just that the .xlsx should be the default.

View 2 Replies View Related

Excel 2010 :: Macro To Save As PDF - Using File Name In Cell

Jun 24, 2012

I recorded a macro to save my file as PDF and assigned the macro to a button. Easy. Now I would like to change my macro to pause when the file is saving to allow the user to enter a file name. If that is not possible, I'd like to reference a cell to use as the file name. I have gone through other posts and tried changing my macro, but always get an error. I am using Excel 2010. Following is my code for saving to pdf.

Sub SavePDF()
'
' SavePDF Macro
'

[Code]....

View 9 Replies View Related

Save And Close File If There Is Text In Cell Range

Nov 12, 2012

I do have the below code to safe a file and close it:

Sub Save_Close()
'
' Save_Close Macro
'
'
ActiveWorkbook.Save
Application.Quit
End Sub

I would like to do additionally something else. I need a macro to do the above, but it should first check if cells A2:C9 do contain text. The text could be anything.

If there is text in ALL the cells, then the macro should save and close the file. If there is text missing in at least one of the cells, a message box should appear saying 'Please fill out all cells'.

View 3 Replies View Related

VBA Code To Save File With Date As Reference To A Cell

Jun 19, 2014

I'm trying to make a vba that would save the file with the end date that will reference to a certain cell that user selects it. Working Sheet is a name of a File, and Current Sheet is a name of the panel where user will select the date.

ActiveWorkbook.SaveAs Filename:= WorkingSheet("Control Sheet").Range("D3").Value & Format(Date, "yyyymm") & ".xlsm", FileFormat:=51

But here i seem to missing the location

And I tried this one:

ActiveWorkbook.SaveAs Filename:="X:Work2014WorkingSheet& Format(Date,"yyyymm"). & ".xlsm" _, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False

but it keeps popping up as 'expected end of statement' for yyymm?

View 8 Replies View Related

Save File / Workbook As Cell Reference Filepath & Name

Feb 8, 2008

I'm trying to get Mac OS X Excel VBA to understand this code however the ChDir reference and the filepath seem to be causing problems. I would like to specify in the code where the file should be stored but I did try removing the filepath section altogether but to no avail.

Option Explicit
Sub SvMe()
'Saves filename as value of A1 plus the current date
Dim newFile As String, fName As String
' Don't use "/" in date, invalid syntax
fName = Range("A1").Value
'Change the date format to whatever you'd like, but make sure it's in quotes
newFile = fName & " " & Format$(Date, "mm-dd-yyyy")
' Change directory to suit your PC, including USER NAME
ChDir _
"C:Documents and Settings USER NAME Desktop"
ActiveWorkbook. SaveAs Filename:=newFile
End Sub

View 2 Replies View Related

VBA Code To Select Cell Range And Save As Text / XML File

Jul 19, 2013

I am trying to write the code to;

1) change to a different sheet
2) select a specific cell range
3) save that range as a text / xml file with a filename derived from a cell outside the given range

Here is where I have got to so far, but it fails

Private Sub Export_Click()
Sheets("Parsed Data").Select
ThisFile = Range("B1").Value
ActiveWindow.SmallScroll Down:=-15
Range("A1:A41").Copy
SaveAs Filename:=ThisFile, _
FileFormat:=xlTextMSDOS
Application.WindowState = xlMinimized

End Sub

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved