found the following code which works for 1 workbook at a time. I am trying to save 7 workbooks at 1 time. Is it possible?
Sub SaveAsCell() Dim strName As String
On Error Goto InvalidName strName = Sheet1. Range("V77") ActiveWorkbook.SaveAs strName
It will work on the first sheet but none after that. I need to have each workbook saved with the value in cell V77. Also if that is possible, is it possible to change where the file is saved as well?
Right now I have a master workbook that will open the 7 other workbooks, paste data onto several pages in each workbook. I would like the macro to save the workbooks. The workbooks are named: 02 Tuesday, 03 Wednesday, 04 Thursday, 05 Friday, 06 Saturday, 07 Sunday, 08 Monday.
I have the following code which is part of a much larger macro which is converting a number so that the the trailing zero in the number 49.50 appears in the formula bar. This is essential as the eventual csv file links to an external printing program which only prints what is sees.
My problem is that this fix works when the file is saved in excel format, but when I save it in CSV format the number reverts to 49.5. How can I convert the original number which appears as 49.5 in the formula bar and is viewed a 00000050 in the file that the sent through. I cannot convert using the text to columns when the file is opened as the other codes in the original file need to maintain the original formatting.
Code:
Sub mc003() For Each ws In ActiveWorkbook.Worksheets ws.Activate
I have made some macros for importing data from a txt fileand to sort the data into a sheet ready to be exported into another txt file. I have made VBA to work with "." as decimal separtor within the spreadsheet.
But, when I run the macro to export the data into a txt file (I have used the macros from this site [URL] .....) it automatically changes all "." into ","
But why?!?
I need the txt file to load data into another program, and this program need the use of "." as decimal separator - and not ",".
I have numerous spreadsheets that I need to open and unhide a sheet, that has XML data stored in cell A1. What I need to do is copy that data in cell A1 and paste it into a text document and save that as an XML file saved as the XLS workbook name with a date stamp.
I'm running into many issues, the main issue is the saving as current file name, and the formatting of the text/XML file.
Here is my current code, which doesn't reference the current file name and is just very generic. Once I get the saving as file-name correct and the formatting of the xml file correct, I will work on it a bit more.
Code: Sub Test() Dim Rng As Range Dim wb As Workbook Set Rng = Range("A1:A2") Set wb = Workbooks.Add With wb Rng.Copy
I am trying to save a worksheet as a txt file. The worksheet has a range of data with a variable amount of rows in column A only. It generally will look like:
where each row of data is in a single cell.Whenever I save it, however, it adds extra tab deliminations in each row after the data, and it adds rows with no data (sometimes just 1, sometimes many).
I am positive that no cells in columns B-n have data in them (even just a space) and no rows after the last intended have data.
Why are these extra rows and columns being inserted? How can I save a txt file that literally has no other spaces or rows or deliminations other than what's intended?
I have a workbook that is being used by users with both "," and "." as decimal separator. This is working all fine, except for one cell, where I need the number output to be displayed with two decimals. See formula below:
="Open at " & TEXT(+OHL!J$13+OHL!H$15,"0.00") & " and Go"
This example does not work with "," decimal settings.
Is there any different way to force two decimals in a text string, except for TEXT (where the format given in itself limits the cross decimal separator functionality)?
I am trying to save this file but I'm having problems with "my Name" This information is in a workbook that is already opened called "Recaps" and the sheetname is "Data" and the value I am looking for is in "$C$5". I open another workbook called "Spare" and want to rename and save it to the code below.
End Sub This macro is the one I'm struggling with. I need to save a copy of the workbook I just opened (currently named MultiFuel Expense) in the same directory using the cell contents of G2 as it's name with _expense on the end.
Sub TestSave() ' ' TestSave Macro ' Macro recorded 08/11/2009 by Tracy ' ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "" & Range("G2") & "_expense" End Sub
I'm actually using a macro that saves all the sheets from a workbook in new separate files, and save them in a specified folder.
Code: Sub Estrazione_Schede() Dim n As Long Dim myNome As String Dim myPath As String myPath = "D:path"
[Code] ......
What I'm trying to do is that, instead of saving all the sheets in one folder, the macro would save them in different folders, depending on specific values in a specific cell of each sheet. I tried to modify the macro like this, but it doesn't seem to work properly:
Code: Dim n As Long Dim myNome As String Dim myPathOne As String Dim myPathTwo As String myPathOne = "D:pathOne"
[Code] .....
With this code the macro ends up to check the condition only in the first sheet and then it copies all the sheet in the same folder.
I have a spreadsheet that imports data, manipulates it then deletes 2 of the sheets then saves the file under a different name to the network. Is there any way to save this new worksheet without it storing the macros - so when the user open it, only the data is there and they get no prompt to enable macros?
I have a workbook with many spreadsheet named Sheet1, Sheet2 and so on. Each sheet is filled completely upto 65536 rows. This data is being picked up from a CSV file. In this file there are sites with each site there is a assciated set of data. What happens is the data that extracts data does not differntiate between sites and when it reaches to the end of worksheet it splits the data into next sheet. So I am trying to create a macro to check each spreadsheet starting with the last sheet in the work book for example last sheet in the workbook is seven it should go to sheet6 and if there is a blank row after row 64000 it should cut all the rows and move them to sheet7. Then it should goto sheet5 and do the same and keep on doing it until it reaches sheet1.
I have a worksheet that has a number in cell K5 - the number is generated on "file open" code and is custom formatted as "TN"0000. Thus 1 appears as TN0001, 2 as TN0002 and so on. I am trying to save a copy of the workbook based on the this cells contents i.e. TN0001.xls, TN0002.xls etc. but the files are saved as 1.xls or 2.xls. The code I am using is
When the user goes to File, Save As, I would like the filename to be populated from the contents of cells B2 and B3, i.e. 11/18/09-23. Is this possible? Also in the same code, can I specify that I want the destination folder to be K:Sheets?
My set up win xp pro office 2007. Object is to save the text from a given cell to drive C naming the file with the value in another cell. E.g.
Contents of cell ("AA5") is a string and the content of ("D5") is a number
I have tried altering the code posted which i found on the forum, it works fine for the purpose as it was indented e.g. save the workbook and in my case saves it as the value in cell D5.
I guess I need to use some form of object to pass to the save as method but my knowledge of this is somewhat limited in addition as the is a possibility of either the cell being empty and the file name existing on the C drive, I need to disable the windows warnings and just go ahead and save it over writing what is on the C drive is of no importance as it will be the same data anyway, I can wrap the save in a "if Len ( AA5)= 0" to stop it trying to save if the cell if empty it the save the text string i am having problems with:
Option Explicit Sub SaveAsExample() Dim FName As String Dim FPath As String FPath = "C:" FName = Sheets("Sheet1").Range("A1").Text ThisWorkbook.SaveAs Filename:=FPath & "" & FName End Sub
I am setting up a "save as" macro that saves a file by replacing another file in a folder. Even though the macro has been recorded by approving the replacement (the prompt appears "the file --- already exists. Do you want to replace the existing file?"), when I run the macro, I am again prompted about replacing the file. Is it possible to avoid the prompt so the file is automatically saved by replacing the named file?
I was wondering if there is a way to write a macro that will take an excel file that I have called Alldata and then have it copy the first two sheets to a new workbook named something else( FullSparameter_0) and then copy the name of the third and fourth sheet into the new FullSparameter_0 workbook and then copy column A-E from sheet dB Alldata.xls and paste it into the FullSparameter_0.xls workbook in the same dB sheet in the same spot. And do the same thing with the Phase Sheet. i know this sounds confusing, but im really new to the VBA stuff.
I just need 15 different files from the original Alldata.xls that will be named FullSparameter_0, FullSparameter_1, .., FullSparameter_14. but each file will have the same two first sheets, Setup Information and Cal Verification, and the same last two sheet names, dB and Phase, but then in the dB and phase sheets, it will copy over the next four columns of data. so in FullSparameter_0 it will have column A-E from sheet dB in Alldata.xls in the dB sheet in FullSparameter_0 (Same with the Phase Sheets). Then in FullSparameter_1 it will have column A and Columns F,G,H and I (for dB and Phase). In fullSparameter_2 it will have column A and then J,K,L and M. Each FullSparameter_X will have the exact same first two sheets and then the other columns for the last two sheets will be pasted into columns A-E in dB and Phase.
I have a worksheet in my workbook that contains data for 25 different airfoils, each one in a cell space of 3 columns and 50 rows. In order to do some analysis on these airfoils, I need to save each 3x50 as separate text file to define input for analysis code. How can I do this in VB in one macro?
I am trying to save my workbook in a specific directory with a specific filename and to incorporate a date field from within the spreadsheet. I have changed the format of the cell so it does not include / as i know this would not work. Saving it is the easy part but adding in the field from the spreadsheet is where im falling over.
I have a text file that contains two rows of data for a single record. when I open the file up in excel, it puts each row into column A. What I need to do is put the 2nd row and combine it with the data in the first row so that i can then run the text to columns wizard and put all the data into its own column.
I have a .txt file (comma separated) that updates daily, which I need to import into Excel. The .txt file contains data from many years, but I only need the data from 2012. Is there a way to only import rows where the data in column "yearID" equals 2012? Since this is a daily operation, I'd rather not import all the rows and then sort/delete rows every time.
I have a several large delimited text files around 800,000+ lines. It cannot all be pasted into excel due to the 65,000 line limit. For my purposes, I only need about 1 in every 1,000 lines from the text file anyways. Is there a way to only bring in the lines I want? Here is the test file layout:.................
I only need the lines that start:
"01","001","------"
I tried running some macros that I found through searching the forums, but I couldn't get any to work.
I'm trying to accomplish is to take an Excel file that contains one column of data consisting of up the maximum number of rows of data (numbers formatted as text? "000000000") and export the data to a text (.txt) file 1000 rows at a time. I would also like the code to allow me to name the .txt files in succession, for example, Pg01, Pg02, Pg03, etc.
The files are going to be used to query a system that will only accept text input 1000 items at a time.
I run the following code to ensure the data is formatted consistently:
Sub a_VerifyDataForInput() ' Start at Cell A1 Range("A1").Select ' Select Column A Columns("A:A").Select ' Format data in Column A Selection.NumberFormat = "000000000" ' Replace all "|" (whatever you call this thing ... pipe???) Selection.Replace What:="|", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False ' Replace all "-" (dashes) Selection.Replace What:="-", Replacement:="", LookAt:=xlPart, _ ........................