Copy Into New Workbook & Save With Date In File Name
I have a report which I have written a macro to reformat, I then want to copy the sheet (Remake) containing the report into a new workbook as the only sheet in the new workbook. I want the sheet name to be changed from "Remake" to "Duty to Consider" and I want the new workbook to save itself automatically as "Duty to Consider - Month/Year" - in this case it would be "Duty to Consider - August 2008".
I think that a Pop Up box which lets me input the Month and Year of the report I am working on would be useful in naming the new workbook, if this box popped up when I click the button which runs my Macro that'd be great. Here is the code I am using to reformat my report. This works fine I just need the changes I mentioned. Application. ScreenUpdating = False 'this will turn on screen updating, making the macro run faster
'This will select the DTC Tab and remove rows 1-4
'This will add a filter to the data to remove duplicate rows
Range("A1:J1307").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
'This will copy the data on the DTC tab and copy it into the Remake Tab
View Complete Thread with Replies
Related Forum Messages:
Date Function- Open A File, Make An Exact Copy And Save It Under A New File Name
I'm working on the following
Workbooks.Open Filename:= _
"D:CommondataIBMmainBRANCHBURG-PRODUCTS-BOM-ALUMINUM-UPDATE-" & Ucase(Format(DateAdd("y", 0, Date)), "YYYY-MM-DD")&".XLS"
ActiveWorkbook.SaveAs Filename:= _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
What I'm trying too do is open a file, make an exact copy and save it under a new file name.
My problem is in the date formula the day is not always the same. In the sample case it's 03 at other times the day will change.
is there a way too get this too work irregardles of what the day might be?
Copy A Sheet Into A New Book And Save File Name As The Current Date
I have an excel file which I use when I book keep journals in work. Each time I come across a new piece of bookkeeping I add to the file, name the sheet and index it. (I've attached a loose example for illustration) so the bookkeeping template.xls gets bigger every day.
Currently, when I book keep on a particular day, I open the template.xls workbook;
draft my journals;
and then manually copy the worksheets I have completed during the day from the template.xls workbook and paste the sheets into a new book and save the days bookkeeping as the current date.
With the file I have attached can someone show me how to write a macro and apply it to each of the buttons on the various work sheet tabs (each button will run the same macro).
Upon clicking a button, I would like the macro to;
Copy the active sheet into a new book and save the file as the current date.
Each subsequent click of a button the macro will check if the .xls file exists for the current date, if it does, then it will just copy the active worksheet to the file that has already been created.
In the new file which is saved as the current date, I need to remove the macro button and the hyperlink that reads back to index.
I have had some helpful macro's provided from another forum, however, the other forum does not appear to enable users to upload files, so I can't quite convey what it is I am trying to achieve.
Date - Sheet To Copy The Info To Another Workbook, Save And Close
I have a sheet that users fill out and there is a macro on that sheet to copy the info to another workbook, save and close.
for some reason, the date, which originates from a cell with the value "=Today()", and when pasted in to the new book, it is pasted values.
the issue is, every so often, the date will say 09/26/10 and continue to do so for quite a few entries.
i have tried almost everything. I checked the dates on the computers, and all are fine. i even went through it step by step, and when the data pasted it, it was 09/26/10.
Save A Single WorkBook Tab To A New File
I am using Excel 2003 and need to save via VBA code a single tab in a workbook to a new workbook. I need to be able to specify the new workbook file name and location. The copy feature on the tab won't work because the data is too large and I get an ugly message using that option.
Save File With Date In Name
I'm trying to write a VBA code to save a file with the word "northeast" and then today's date. So today the file would be saved as "Northeast - April 16, 2009". I can't seem to figure it out. Anyone have any ideas?
Save File With Date
In the code that i have, vb is making me a excel file and saves it with the title i putted.
I want him to save my files like this: example dd:mm:yyyy
Here is the
ActiveWorkbook.SaveAs Filename:= _
"D:Sablon citiriCalea 13 Septembrie_Sablon citiri.xls", FileFormat:= _
xlExcel8, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
Call MsgBox("Va rog sa asteptati pana se creeaza registrul de lucru.
Some of the words are in romanian.
The bold text ,if is possible, it should be like this: D:Sablon citiriCalea 13 Septembrie_dd:mm:yyyy.xls (the date when i do the saving).
Macro To Save Workbook/File As Cell Value
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.
Save A File With A Date Taken From A Cell
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.
Macro Cannot Save File With Date In Name
The following macro is returning a 1004 runtime error.
FName1 is a book title PHOTOSHOP MADE EASY which is trimmed to remove blank spaces at the end.
FName2 is the date =Today() formatted dd/mm/yy.
When the 1004 error appears the filepath shown looks like this ...
Save File As Cell Value (Date)
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
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")
Dim strName As String
'copy today's date from invoice template
Application.CutCopyMode = False
Save Workbook To Desktop If File Doesn't Exists
I'm having a slight problem with this script. What I'm looking to do is before the workbook is closed is check to see if the workbook already exisits on the users desktop if it doesnt then save it to the users desktop. if is does exists then just exit the sub. Here is what I have so far but for some reason it kept displaying the aleart message that the file already exists and wants to save it again.
I just added the displayalerts = false in but the script still does not know that file already exists. So when the file is closed it keeps saying file has been placed on your desktop.
Create & Save Workbook To Same Path As Macro File
I have code to create a new workbook, and when I try to rename it I get "Compile error: Can't assign to read-only property."
Dim objXlApp As Object
Dim wkb As Workbook
Dim wks As Worksheet
Set objXlApp = CreateObject("Excel.Application")
' Create a workbook
Set wkb = objXlApp.Workbooks.Add
' Delete all worksheets bar the first one.
For Each wks In wkb.Worksheets
If Not wks.Index = 1 Then
'Create some worksheets and names
.Worksheets(1).Name = "myWorksheet1"
.Worksheets.Add.Name = "myWorksheet2"
.Worksheets.Add.Name = "myWorksheet3"
.Worksheets.Add.Name = "myWorksheet4"
Save File / Workbook As Cell Reference Filepath & Name
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.
'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
"C:Documents and Settings USER NAME Desktop"
ActiveWorkbook. SaveAs Filename:=newFile
Save Workbook With Current File Name To Specific Folder
I recorded a macro to save a workbook to a specific folder using the current file name. However, I've tried to remove the absolute reference to a specific filename but it is not working for me. Am I close?
ActiveWorkbook.SaveAs Filename:= _
"H:Files and DocumentsPROJECTSSR 2 SS Phase Two Component ReliabilityWinTrac Files xt_conversionsexcel_version" & SheetName _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Save With Date & Re-Use Workbook
I work in a fiberglas manufacturing plant where we use a single, daily "count" sheet to track production. At the end of the 24 hour workday we clear the sheet and reuse it. This sheet is published as a web page so others can view it throughout the shift. What i want to do is to be able to either automatically or by running a macro either save each day to a master workbook, where each sheet is assigned the title or name of the month and day, i.e. 1116 for november 16 OR have each sheet saved individually to a common folder with the name of the month and day. I would appreciate any guidance, suggestions or code.
Save A Copy Of A File To A Given Folder
I have a bill of materials for each job I do, I have multiple cut sheets in one spot on the network that must be individually copied and pasted into the project file for each job. I’m hoping to automate the process. Post extraction dump from AutoCAD, my text file goes into a excel file that the information is used by multiple tabs including a bill of materials.
From the bill of materials, I want to say “if C3>0 get file 10P0044HP2.DOC” . . . I want it to get the file and save to the individual project file. .. Possible I’m not so sure. But I’m not sure of where to start.
Save File With Date From Cell Appended To Name
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.
Dim strName As String
On Error Goto InvalidName
strName = Sheet1. Range("C1")
InvalidName: MsgBox "The text: " & strName & _
" is not a valid file name.", vbCritical, "TitleBar Name" ........
Collect Date From User For Save File Name
We have an excel file which is made every thursday for comparison purposes etc. I've made an macro (excel 2003) which - on start - asks via an inputbox for the extension in date format for saving purposes. Later on, the macro will search for the same file but from last week to open it and copy/paste a 'comments' column into this new one. All went well, everybody happy. However it may be well possible that file is made and saved but with an extra extension: example:
dir to save = C:file
file when starts runs inputbox "Please enter a date (e.g. 2008-06-20)"
The macro records this string as mydate:
Dim mynum 'As String
Dim resp As Long
'Define extension for the file name to be saved and the correct path (dir) where this file will be stored.
mynum = Application.InputBox("Enter the filename's extension to save in yyyy-mm-dd (e.g. 2008-06-30)", vbOKCancel)
If mynum = False Then
msgbox ("You do not want to continue? Ok, programm stopped")
ElseIf mynum = "" Then..............
Save File Name With Date/time Stamp
I've got a simple save macro below and was looking for a way that when this macro saves the file can it add the system date and time to the name.
' ActiveWorkbook.SaveAs Filename:="C:
ashfinchNFC-ORDER.XLS", FileFormat:= _
' xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
' , CreateBackup:=False
Save Daily Workbook As Date
I have an excel workbook that needs to be updated daily (new figures replace old ones at the moment), Want I want to be able to do I after filling in the cells, through that workbook be able to create a new identicle excel file for that day, with the name of the file being the date for that day, so basically at the end of every day a new file is created in a sought of archive. I understand I can just "Save As" every day, but the person that I am doing this for is .... well not the most competent of people.
Copy Worksheet And Userforms And Save File As Specified Name
I have this macro I recorded and pieced together from info I found on the net. It works the first time you run it but then it dies because the next new workbook is not "book1" what I would prefer is to have it save the new workbook as the value of sheet2 F2 and "Product Bulletin" so it would look like "##### Product Bulletin" but I don't know how to write it.
Copy Database File And Save To Desktop
Let's say I have a database called testTemplate.mdb in c: which is a template-like database where i import data to. Is there a way for me to copy the testtemplate.mdb and past it to my desktop with file name test.mdb. I don't want to copy any data from the database, just the table's + queries. I would like this to be done via a macro... In order for me to execute other macro's to copy data from excel to that test.mdb file on desktop.
Copy Values Only To New Workbook & Save
i need to copy from one workbook to another at present i have formulars in columns a b c d e g in f and h the is data that could go to f and h100 these are not formulars
i need to be able to copy the data from a1 to the last cell with data in it in column A to the same row in column h
Save A Copy Of The Open Workbook
I know that the line in my code Worksheets.Copy is NOT what I need to have to make this work, but with it it's the closest I could get to what I want.
I want the user to be able to click the SAVE command button, be allowed to either accept or change the default save options, save the current workbook and then go right back to the form that has the SAVE command button. Sounds simple, I know, but when you don't know the right commands to save the WORKBOOK, not just the WORKSHEETS, it becomes a P.I.A.
I know there's a lot there, but here's my code, which is just a slightly altered version of the code by Ron de Bruin:
Private Sub SaveData_Click()
'If no date has been selected then don't allow SAVE
If PubDateLabel.Caption = "" Then
MsgBox "Publication Date not set. You must select a date before saving.", vbCritical, "No Publication Date!"
Copy Worksheet To New Workbook & Save
I have a workbook with a worksheet named "Report"... this sheet and it's macros generate a report from data on another sheet. I'm adding a button to copy the (filled) Report sheet to a new workbook, rename the new sheet in the new workbook "Rep[Name]", then save and close the new workbook. I've recorded a maco of me doing these tasks manually, but what's recorded seems very generic, and does not seem to specify what's really occurring...
For example (in part);
> Rightclick on the Report tab
> Move or Copy
> To Book: (new book)
> [x]Create a Copy
This recorded macro does not specify (new book), or Before:"Sheet1" as was the result of my actions... and when replayed back, only makes a copy in the active workbook, before the active sheet...
Save Workbook As Current Date & Time
I'm trying to save a file with current date and time...I used the code from the following thread:
Save File Name With Date/time Stamp
ActiveWorkbook.SaveAs Filename:="C:FinalOutput.xls " & _
format(Now(), "mm_dd_yyyy hh mm AMPM"), FileFormat:=xlNormal, Password:="", _
WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
Now when I try to run the macro, it gives me an error saying: Compile Error, Wrong number of arguments or invalid property assignment. And it highlights "format" in yellow.
Copy Selected Range & Save To Text File
I also use VBA in a terminal emulation program that I use the following command to 'screen scrape' the current display memory and quickly Save it to a .txt file:
.SaveDisplayMemory "C:File1.txt", rcOverwrite
What I want to do in Excel is, Copy the current selected Range() and Save it to a .txt file.
I know how Save the current Sheet to a .txt file, but can't figure out how to Save just a Range() of cells.
Automatically Save Copy As Text File When Data Changes
I'm trying to create a sub that will save my worksheet to a tab delimited text file anytime there is a change in the worsheet data (all cells are linked to cells in other workbooks). I've figured out the command to save the file
ActiveWorkbook.SaveAs Filename:= _
"C:Documents and SettingsChrisMy DocumentsBook1.txt", FileFormat:=xlText _
but I'm not sure how to get a sub routine to start running when the file opens and to have it run continuously while open. I've found the command:
that will flag when any cells in my range are recomputed and run a function, but functions don't allow me to save the file.
Save Workbook Copy To Same Path As Original
I'm trying to save a copy an excel file in the same directory of the original file. The code is pretty standard but it does not work if the file is stored in C: (only c: ) Is that a bug or am I doing something wrong? Anyways here is the code in case someone is interested in trying it out:
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls", _
InitialFileName:="CMS_" & Format(Now(), "mm-dd-yyyy"))
If fileSaveName <> False Then
MsgBox "Backup copy saved as: " & fileSaveName
Save Copy Of Workbook, Leaving 1 Sheet Only
I have a workbook that has worksheet called "Data". In that workbook, there is some codes for the event of "workbook_beforeprint". My question is whether i could create a copy of the "master" workbook and delete all the unwanted sheets but "Data" sheet using VBA. There are some codes of creating a new workbook but i suppose i need to the exact copy of the current workbook using VB
Macro To Open File, Copy Paste As Values And Save As Excel Html
I have a folder containing 40 single sheet excel workbooks and I would like to automate following tasks:
- Open each excel file (need to open the file so as to update it since it gets the data from another workbook through =formulas)
- Copy paste as values
- Save this as excel html in the same folder as original excel files (keeping the original file name)
- Close (original excel file should not be changed ie formulas should remain in place, only the html file will contain values)
- Since there will always be xHtml files with same name need the macro to replace the excisting file
My abilities with excel are limited to functions, no VBA knowledge other than finding ready codes and pasting them in the module.
Since this routine is to be run almost daily the macro should run all files, instead of one by one.
I just hope that I am not asking too much for excel to handle and I hope that explanation is clear.
Automatically Save And Copy Values Daily With A Date Stamp
I have an excel file that I use to track all my financial investments. The file is already set up with a query to retrieve stock prices when I refresh the document.
I would like to be able to open up the document, and store the closing price of the stock(s) with a date in the next column over. With this information I can graph weekly, monthly annually, or any time period I want.
I have been searching for a couple of hours now, and I could not find anything similar to this. I would think this is a pretty common idea for many people tracking their investments with Excel, so if it has been covered perhaps someone can point me in the right direction.
I don't have any programming experience in excel so as detailed of an explanation as possible
Copy Workbook Sheets To New File
I am having difficulties copying a entire workbook into a separate new workbook (to make a number value copy for printing and saving purposes). My problem is the hidden sheets are not always hidden and the unhidden sheets are sometimes hidden. This all depends on a different macro that i am running through the workbook.
sometimes i need sheets 1,2,4 to be copied to the new workbook
other times i need 1,2,3 to be copied to the new workbook
Move/Copy A File Workbook Without Opening
copying within a workbook...
I have an external .xls file I'd like to copy to a new directory from within VBA. I know how to create the directory, but is there a way to do it other than opening the required file, and doing the " saveas" thing?
Can I just create a copy directly?
Retrurn Date Portion Of File/Workbook Name To Cell
I am using Windows XP and Excel 2003. The filename I want to open is called "MMO Activity Report 25-09-06.xls". Part of the filename as "MMO Activity Report" will never change but "dd-mm-yy" will change constantly. I want it to show in active worksheet cell A1 in format YYYY.MM.DD ie. 2006.09.25. I type in Sheet1, cell A1 as "=filedate()" but it shows me "#VALUE!"
Filename = Mid(Right( ActiveWorkbook.Name, 21), 1, 9)
filedate = Format(DateValue(Mid(Filename, 1, 2) & "-1-" & Mid(Filename, 4, 2) & "-1-" & Mid(Filename, 7, 2)), "yyyy.mm.dd")
File Copy Macro - With Directory Specified In Workbook Cell
I am continuing to struggle with my first attempt at a macro, and wonder if someone would mind taking a look to see where I have gone wrong? All I am trying to do is create file copying tool where the user can define the source and destination directory in workbook cells, and assign the macro to a button to complete the copy of all files from source to destination.
The macros do this:
Source and Location directory defined in Sub Archive1.
These are passed to file copy macro Sub ArchiveScript.
This macro checks for presence of destination directory, ensures that the directory backslash is in place, specfies the variables fn and fn2 to make sure the filecopy command copies all files in the directory, and then carries out the filecopy function itself.
However, I am getting two errors from the code that I can't figure out (I am still very much a beginner!)
- Invalid procedure call or element on fn = dir() at the bottom
- The copy still works, but only seems to copy one file from the source to the destination, and not all of them.
Open Chosen File, Copy Range & Paste Into Workbook
I'd like to know if it is possible to run a macro in a workbook that will open another workbook (of the users choice) extract data from it, such as columns from its sheets then paste that data into the workbook the macro is running from. The file to be opened will change, so i've found some code that enables the user to select the file to open then open it.
Dim strFile As String
strFile = Application. GetOpenFilename
If strFile <> "False" Then Workbooks.Open strFile
This brings up the standard windows choose file to open box, then opens the selected file. Am I correct in thinking that the Dim here will store the file name I select in the open file box? If so, I'd like to know how to select the workbook using the dim so I can manipulate it from the workbook I'm running the macro in. Incidentally, once the the data has been copied, I'd like the workbook opened with the macro to be closed.
Copy Data From Open File To Current Active Workbook
I want to create a standard macro that will copy values from a Master workbook to the current, active workbook I have open. The problem I have run into is when I record a macro it also records the name of the active workbook I'm copying data into and I would like it so when I bring up a workbook I just run the macro and it copies the values in. I'll be doing 8 different macros that each copy different values from the Master spreadsheet
Find File By Date. Copy & Paste
I work for a chicken hatchery. So, a couple preliminary things by way of explanation:
1. The day we place our eggs in the incubators, we fill in an excel file containing a list of all the farms from which those eggs came. This is called the "Egg List" workbook.
2. After 21 days have passed, and the eggs have turned into chicks, we open that original file. We copy cells from one column of that file (the workbook is called the “Egg List”, we copy “Sheet1” cells B7:B50), and paste them into another Workbook called “Chick List.”
My question is this:
Is there a macro I can put into the “Chick List” workbook that will automatically locate that particular “Egg list” workbook file that is 21 days old, and paste the contents of its cells B7:B50 into cells A7:A50 in my “Chick List” Workbook. It is preferable if this can be done without opening the old “Egg list” file. But if this is not possible, I’ll take whatever I can get.
Here is what I have, which works okay as far as finding the file. I bootlegged this from another part of this helpful website. But I cannot figure out the syntax for getting cells B7:B50 from the Egg list to copy into cells A7:A50 of the Chick List.
Dim FSO As Object
Dim i As Long
Dim sFolder As String
Dim fldr As Object
Dim Folder As Object
Dim file As Object
Dim Files As Object
Dim this As Workbook
Dim cnt As Long
Dim filenew As Object
Save As Macro :: Save File To Folder
I have a macro that copy one sheet of the Active workbook and sends it via email.
I need to add a code in this sheet so when one opens it from the email, with a command button to be able to save the file to specific, fixed folder on the local network with it’s original file name.