I have a csv file. When I open it by double clicking, all the finance figures appear as currency with the currency symbol. I can use the SUM function on these and it's perfect.
However, when I open this file using a macro, these same numbers look the same, except that they are now left justified and are text because the SUM function no longer works. If I select a range, I get the count of the number of items selected showing at the bottom of the screen but not the sum.
I have tried opening the file using the OpenText function which has several ways of setting a date format to the fields but nothing for numbers.
I have even tried, in the macro, selecting a cell with numeric 1 and then selecting the range and pasting the 1 as a multiply function but this doesn't work either.
I have the following macro that is linked to a button.
There is also a function that is called to check to see if the file is already open.
These macros & functions work properly.
Basically, the Case statements check the extension of the file to be opened and then calls the correct macro to open that particular file.
I have shown the macro that is called by the Case statement that has the extension .xls . . . Excel
I want to keep these Case statements as I always want Excel files opened in new instances of Excel.
What I need is when the existing case statements do not find an extension that is listed, I want code added to this macro that can open any type of file, such as files with other types of extensions or without extensions.
My son suggested that I should try to get a macro that could open the file using the RUN command found under the Start Button. Sounds good to me.
I have a lot of files with data that i need to copy into a master file.
I could open each file copy the data i need and paste it into the file. But I know there must be a way to do a loop macro.
All the files are labled "Sauce Data "Date"". all the data is in the same place in each file. I can easy have a list of all these file names in a tab in a main file "Main Data".
I what to be able to open each file copy from tab "Sauce info" A1:B65, and paste into "Main Data", tab "main" and then create a long list of data.
I have 50 files each with 1000 numbers in column A.
I need to compare every list with every other list and calculate the Pearson function.
I am ok with the vb code to compare every file with everyother.
I can do this by opening each file then closing but it takes too long.
Each of the 50 csv file names is in my destination workbook
I would like to define an array using the file name, then extract 2 lists without opening the files then perform the pearson function and place the value in the destination workbook. (The pearson function just measures the strength of correlation between 2 sets of numbers)
I am trying to view a csv file that has string data, some of them like '395E02'. Excel automatically converts this string into an exponential number. Is there any way to stop Excel from performing the conversion so I can read the number as is?
Last monday I clicked on my quick launch icon for my time card, which is in excel. It opened up, but I got an error message saying that excel had an error, send report or don't send report. Closed everthing out and clicked on the icon again, but this time excel oppend but the file did not. I get just a blank (don't know what to call it) spreadsheet. There are no cells to enter anything in. I do get the "File, Edit, View, and so on" at the top. I can click on File than Open and browes for the file and open it that way, but I can't open any Excel file by double clicking it in explorer.
I am trying to write a program that will open a group of files whose name is in the format S1T1C1.vfc where the S1T1 part of the name will remain constant (S refers to subject number and T refers to trial number) but the "C1" (condition) will be different every time since we randomize our trials. I have a working loop that will open all the trials for a particular subject but only if I remove the last two letters of the file name in the folder. Is there a way to only look at the first part of the file name (which will be unique) and ignore the last two characters?
I am trying to come up with a macro that is able to open a .htm file in Excel, perform a set of code, close the file, then repeat the process with the next .htm file in the folder. I found the following post which has helped me thus far, but there is something that is not allowing Excel to open the .htm files even though there is no problem opening them in Excel manually or with another macro I've made. Here is the link to the set of code I'm currently working with:
I've put some .xls and .csv files into the target folder and the program works perfectly which tells me Excel is having a problem with the .htm format for some reason. Here is the set of code I currently have which I have slightly modified for the new file format:
I need to open all files in a folder to modify a date in the first line. The files have a .cdr extn for a particular application but are basically text files with xml type tags. What would be the best way to proceed?
I tried opening as text in VBA but they are blank.
On the first worksheet of my workbook I have a list of file names in cells I11:I27. The filenames have been 'compiled' using the concatenate function, so for example, although cell I11 displays:
Richard 2007-09.xls,
the cell contents are really:
=CONCATENATE(G20," ",L9,"-",J9,".xls")
Using VBA, I want to be able to open each respective file in cells I11:I27, copy the contents into this workbook (sheet=raw), and close it. My problem is that I don't know how to tell excel the filename in VBA, because the cells contents are not really the filename - they are a formula.
I'd like is for an automatic job to be set up on my machine (windows) that opens the CSV files, formats them, then closes the file (as a .xls doc). So that anyone subsequently opening the file opens a formatted spredsheet.
I tried setting up the auto_open macro function, but I have trouble because I need to select the data (which is in delimited csv format) before I run the formatting routine, opening the file and running the file can't cope with this because the selection (Col A) has not been made even though I include the column selection before the formatting when recording the auto_open macro. the error reported is:
runtime error 1004: no data to parse
So is there a way of doing this??
To format the data, I use the following steps:
1, Select column A 2, Data>Text to columns>delimited>~ (~is the delimiter) 3, Column data format text for col A & B 4, Select all (top lh box above cells) 5, auto column width (double click on a column boundary) 6, select columns C to I 7, centre justify
I have several text files in a folder which I wish to open one at a time in order to copy the data into a spreadsheet.
e.g. I want to open text file #1, copy the data, then close the file, open text file #2 copy the data and close the file, and so on for all of the files in the directory.
I have Mac 2008 Excel. For my work, I download .asp files and open them in Excel. No problem. The problem is... I'm wanting to use another computer at work that has Mac 2011. When I open the exact same .asp files, they show coding (html?). I can fix this by changing the name of the file extension from ".asp" to ".xls." But I convert these files a lot during the day and this is an extra step I don't want to take. And it works fine in version 2008. So what can I do in version 2011 to make it open the files without all the coding?
I would like to be able to open multiple .txt files into one excel document. I had been using a code that opened all the files I wanted into a NEW excel document. I have a template that I use and I want the files to open in sheets following the main template sheet. This is what I have been using:
Sub CombineTextFiles() Dim FilesToOpen Dim x As Integer
[Code]...
And it worked just fine for that purpose but how could I edit this?
how I could use VBA to make a table out of data that would be cool too.
I have a long list of .xls files. I have to open each file, copy a few columns of data and paste it into a single xls file. I can write a macro to do this, the only problem I have is how do I get the macro to open all the xls files with different names ? I am thinking something like sorting the files by date and then let the macro open files from the oldest to the most recent one, but is there a command to do that ?
I am trying to write a Macro that will do the following.
1. Using a new workbook 2. Open a file in a in a directory. Then 3. Run a vlookup using the opened file as the filename in the vlookup 4. Paste the results of the vlookup into the original file next to the file name. 5. Close the file and open the next one in the folder.
The folder contains about 2k files that it needs to loop through. I found a macro on this site created by Ravishankar and attempted to add to it. Not going so well.
I have the following codes for 2 command buttons for a userform.However, the following codes opens the excel files that I've selected.The results that I want is to have a third command button such that when it is clicked then it will open the 2 files specified on the 2 textbox.How do i modify the codes?
Code: Private Sub CommandButton1_Click()
Dim f As FileDialog Set f = Application.FileDialog(msoFileDialogFilePicker)[code]......
I tried to search for threads about opening files from multiple subfolders but the following codes does not open files. Could someone please check and edit the code that I have below:
Dim lCount As Long Dim wbResults As Workbook Dim wbCodeBook As Workbook
I am working on a worksheet with quite a few advisors who will be using the sheet, because of this reason I am trying to cover my back with as much error handling with my VBA script as possible. Where I am struggling is the following line:
Code: Set cb = Workbooks.Open("wilm-dchome"UserName"DesktopCurrent projectPipeline Grouped.xlsm")
I want to have an error handler that says if this file cannot be found use the following line of code instead:
Code: Set cb = Workbooks.Open(Application.GetOpenFilename())
It may even be just a simple if statement instead but I cant seem to find the answer.
I have this script below which I am trying to modify to pull information from each file in the folder and draw cell values from different sheets within the file. I have the script working prior to the modification but the difference was I was pulling all the different cell values from the same single sheet in the file. I believe the issue I have (Excel reporting that file is already open and then eventually erroring out) is because the way I'm going about this is causing Excel to open the file multiple times without closing (my coding isn't the best) here -
Do While fn "" On Error GoTo Handler: Set ws = Workbooks.Open(myDir & fn).Sheets(7) Set ws2 = Workbooks.Open(myDir & fn).Sheets(2) Set ws3 = Workbooks.Open(myDir & fn).Sheets(3) Set ws4 = Workbooks.Open(myDir & fn).Sheets(8) Sheet4.Range("a" & Rows.Count).End(xlUp).Offset(1).Resize(, 6).Value = _ Array(ws4.Range("AI6").Value, ws.Range("ac4").Value, ws2.Range("ac4").Value, ws3.Range("ac4").Value, ws4.Range("ac4").Value, myDir & fn, fn & "-" & ws.Name) Workbooks(fn).Close False fn = Dir Loop I'm hoping there is a better way of pulling information from multiple sheets in the file that actually works as the above now I think it through is obviously not very clever.
A second issue I have is that whilst some people running this script don't have access to save to this network drive (so can not save changes), some users CAN. Is there a way I can force the script to open these files as Read Only or ensure that they are closed UN-saved - just to cover any mishaps??
I'm using Excel 2007. I didn't change a single option but for some reason this problem came up. When I open an already saved Excel file it opens up in a newly created file. For example, if I open a file saved as "Monthly Sales" it will open it up and rename it as "Monthly Sales1." When I go to save it again, which would normally just save it where it currently sits, it basically acts as if I hit Save As and pops up the box asking me where I want to save it. This is extremely annoying as most of the places where these files are saved are several folders deep which makes it time consuming every time I open and alter a file. I can't find any options that looks something like this and it only happens in Excel.
Ive got about 300 different excel files all with the exact same format the only thing that is different is the values in the columns but they are all raw reports dumped into excel.
because I had to run them all seperate for certain reasons is there a way to combine all these files into one file without copy pasteing them all into one sheet.
Is there a way of reading .csv files and copying the data from say Sheet1 without actually opening the file itself? I have .csv's that will take some time to open due to size so dont really want to open them, but want to copy the data from all of them within a specific folder.
When I attempt to open a file I get a blank screen. If I try to close the window it asks if I want to save the file so it is must be open but not visible. Have I inadvertently clicked on an icon with which I am not familiar?
All of the sudden, I've started having issues on one PC with Excel opening CSV files.
I work with these files every day and they work on other computers.
The problem is that if the field value starts with a dash, Excel will not show any records before that. Meaning, if there is a record on line 50000 that starts with a dash, it will not show the previous 49000 records.
I can open the file in Notepad++ and find all '- and replace it with ' and it will work fine. But I have hundreds of files.
This just started. I'm using using Office 2010 x64. I'm tempted to get Office 2013 to see if this will resolve it as something has obviously went wrong.
In the past, I would open the CSV files just like any Excel file and NEVER any issues. I would do this with multiple files each day but even the file that I use to not have issues with in the past is now an issue if it has a dash in a field.