Create New Workbook And Save Filename From Cell Value
Nov 1, 2009Im trying to create a macro that when i click the button a new workbook is created and saved as the value from C5 cell.
View 9 RepliesIm trying to create a macro that when i click the button a new workbook is created and saved as the value from C5 cell.
View 9 RepliesI'm trying to record a macro that calls up the saveas dialogue and uses a filename from a cell (it's the w/c date). I can start recording the macro, open the dialogue box and copy the contents of the cell but i can't get it to paste as the filname.
What I'm trying to achieve is to allow users of a muli-sheet workbook to be able to click on a 'save' button on any sheet and have the workbook save with a filename which includes the current week commencing date. This way all the weeks changes will be in just one file and from the following monday a new file will be started the the old one left alone as an archive.
what code can be used to be place in a Command Button on a worksheet that will use the value in a cell, change it to the directory where it have to be saved and save it to the value of another cell. Example:
On a worksheet called "Customer", at cel A1 will be the customer's name and at cell A2 will be the asset number. Now let's say a directory does not yet exist on the root for this customer, a new directory must be created in the root directory by using the name in A1, and the workbook must then be copied and saved under the value of A2.
I'm trying to use the code below to paste special my first sheet to remove the formulas, then delete all other worksheets then save as a reference number (which is linked to the worksheet im saving) but I also need it to save in a specific folder.
Sub SaveAsCell()
ActiveWorkbook.Save
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Cat Nos").Visible = True
Sheets("Supplier Info").Visible = True
Sheets("Codes").Visible = True
Sheets("Buyers").Visible = True.................................
way for my engineers to save a field ticket with a certain name based on data from a couple of cells in the worksheet. Re: Auto generate "Save As" filename from text and tried to use some code posted in the thread, but I an still not having any luck.
What I want to do is create an active X button when clicked on, would save the workbook to a certain folder. I want the name to look like this:
SO1!M3_SO1!M6_SO1!H2.xls
This is what I have so far:
Private Sub SaveMe()
ThisWorkbook.SaveAs Filename:="C:usersdefaultdesktop" & Range("SO1!M3").Value & Format(Range("SO1!M3").Value, "text") & ".xls"
End Sub
Would I click "general" or "workbook" in VBA when I enter this code?
Our business has a spreadsheet set up for invoicing. A Macro has been created to increase the invoice number, save to the desktop as a PDF with a file name taken from the cells
This is working on my colleagues mac but when we've loaded onto my computer it errors, when I debug I am getting the following error:
Sub Macro3()
'
' Macro3 Macro
'
'
Range("g10").Select
[g10] = [g10] + 1
[Code] .......
I want to write a piece of code where each day i run this code
I want add a workbook
Copy range ("A1:C5") to this new workbook
Save new workbook in a particular folder with the name customer data and todays date and save as CSV file
I run this this code every day so it should only add todays date at the end for filename
If for some reason I run this code again in the same day..
I want to have a msgbox stTing you have already ran this code today and exit sub
I have a workbook with roughly 28 tabs(sheets) and i need to be able to run a macro that will create a new sheet for each tab and name it based on the tab name.
View 9 Replies View RelatedI have a workbook (see attach) That has 2 worksheets. (LOAD DATA AND SKIP) What I would like to do is have VBA that automatically filters for each of the names in column A, creates a new workbook naming the workbook as the filtered name (ex D Fowler) and current date and then copy in all info based off filtered data from columns A thru Y Then save and close for each of the names in column A.
View 6 Replies View RelatedI have a workbook which contains a list of data on the first worksheet. I need for a macro to copy the name in each row,along with its data in that row and paste it into the corresponding locations on a template located on another worksheet. It would then save the file using the date (col. a) , then the words " Scorecard for" and then the name (col. b), then loop for each row until it reaches the end of the list.
I located this code here here.However I dont know how to modify it to fit my needs. I dont have 2 separate categories for two score cards in column b. It would all run off one scorecard and each row of data.
[Code] .....
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
wks.Delete
End If
Next wks
'Create some worksheets and names
With wkb
.Worksheets(1).Name = "myWorksheet1"
.Worksheets.Add.Name = "myWorksheet2"
.Worksheets.Add.Name = "myWorksheet3"
.Worksheets.Add.Name = "myWorksheet4"
End With...................................
I have a workbook that gets saved many times with many different filenames.
All I want to do is have cell A1 display as text the name of the file.
eg similar to the date function, there should be a = filename function .
Read “My Documents” Path And Use Result
Problem:
Note:
Typical user OS will be Windows XP Pro / Win 2K
Excel version : 97 / 2002 / 2003
1. Corporate network security settings will only allow directory/subdirectory creation in the “My Documents” section of customers individual computers.
2. Per customer request, VBA application needs to save extracted files for future use.
3. I can specify an initial “My Documents” subdirectory be made and the VBA application file be loaded/copied into that location – i.e. – “My DocumentsCat”.
4. When VBA application is opened from that specified directory, (first time), the application needs to make an additional subdirectory tree to save future files. I can read the opened from location via VBA with the following:
Dim filepath As String
filepath = ThisWorkbook.Path
As an example – this code would produce a string definition of “filepath” – such as the following:............................
I would like a macro to be able to save 26 tabs within the one document to individual PDFs.Preferably I would like to be able to specify each time exactly which tabs get printed, because often I don't need to print all 26, just the first 10 or so.I would like each PDF to automatically be named with the value in cell E10 of each tab.E10 already has a formula to create its final value. It references cells from other tabs within the same document. Hopefully the fact that this cell has a formula in it won't affect my ability to use the resulting value as a 'save as' reference?I would like it if the PDFs save to the same location as the Excel sheet from which they're generated is located. The location of the excel sheet will change every three months, so I'd prefer not to specify a location with a specific filepath, as it will have changed by the time I run the macro again.
I am using Excel 2010.
I have a problem with the following code
View 2 Replies View RelatedBelow is a bit of a big macro i'm writing but I'm not sure how to edit my code to append the date after the filename. Then i'll need to refer to the exact filename later in the code?
View 2 Replies View RelatedI'd like to record a macro that allows me to take the current file "file.csv" and save it as "file.xlsx"
I can't get the variable right (just messing around in VBA to have it get the file name and save it as a different format (csv to xlsx)
I've tried:
Function GetFullName() As String GetFullName = ThisWorkbook.FullName End Function
I want to create a macro that when executed changes the name of "File1" to "File1 - Edited 8-9-2012". With the date being today's date (variable). This file is going to be emailed to someone who will then execute this macro.
Is there a way to prompt the Save As window with the updated file name so the user can save the file where ever he/she wants?
I want a macro that will save a copy of the current file using specific naming convention. My file is called OTR2CMMASTER - I want the macro to save a copy as OTR2CMSAGE(CURRENTMONTH/YEAR). The OTR2 is a named field (ProjectCode) in the workbook.
View 5 Replies View RelatedIn a workbook, I use a macro to extract a sheet and save it as xls.
What code should I use to prompt the user to define the location and name of the new file to be saved?
Is there a way to save a file and have it automatically put today's date in the file name?
Example: original File name = test.xls
desired file name = test072807.xls, or test.072807.xls, or test.07 28 07.xls
So, I open the file, do whatever, and then click save.
When I click save, it does one of the above, given that today is 7 28 07.
I would like to create a routine that automates the save process, specifically I would like for the user to click file/save, and then have the save name match the value in a "job number" cell. So if the user runs the save routine, it will automatically save as cellsvalue.xls. Is this possible? and if so, would it be possible to check the value of the cell and if the cell is blank return a message forcing the user to enter a value in the "job number" cell before they could save?
View 2 Replies View RelatedI have two workbooks open. I need to "Save As" and close workbook 2 with a file name from a cell in Workbook 1. The macro is running from workbook 1.
I'm guessing a change in the last line. I don't know what Dim means either.
Dim FName As String
Dim FPath As String
FPath = "G:"
FName = Sheets("sheet 1").Range("A1").Text
ThisWorkbook.SaveAs Filename:=FPath & "" & FName
The code below pops up two input boxes asking the user to enter the location number and the vendor number, and then saves the worksheet as a text file to the desktop based on their input:
View 5 Replies View RelatedI have a spreadsheet that from a button I want to run a macro that will input todays date, the value in cell A1 as the filename into a default dialog box that is at a default file path. I have been trying to do this for several hours and can not completely get it done.
View 9 Replies View RelatedThis link worked perfect for my needs: Create a List of Hyperlinked Files:
But is there any easy way to only show the filename insted of the full path for the name of the hyperlink? Now it shows it like :C:MyDocumentsTestings est1.xls
I only want it to show as: test1. I still want the hyperlink to work
I currently use the following code to create a duplicate file based on two cells within a directory and folder i specify. These cells consist of the team and week commencing date (mondays date of week which is cell 'Main Menu'!K8)
View 7 Replies View RelatedI have two columns one of which has filenames and the other having values. I need to creating a macro that takes each value from a cell outputs it into a text file and then saves it with the filename of the cell next to the value. I'll need it to go down the columns and create separate text files for each.
View 7 Replies View RelatedI am trying to save a workbook created by another macro using the value or text from cell A6. I get a runtime error of 1004: Method 'SaveAs' of object'_workbook' failed. Here is the code that I have.
Sub SaveAs()
Dim FName As String
Dim FPath As String
FName = ActiveWorkbook. Sheets("Sheet2").Range("A6").Text
FPath = "c:ISSignup"
ActiveWorkbook.SaveAs Filename:=FPath & "" & FName & ".xls", _
FileFormat:=xlNormal, CreateBackup:=False
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