I have a question about CSV files...I have to import about 80 csv files into excel as separate sheets in the same workbook. I can only get it to import into its own workbook. Is there a way to import all of them into the same workbook all at once?
Also, I am currently using csv files, but if what I want done can be done with a different file type, it doesn't matter.
how I can loop through folders to select files starting with a certain word and copy all of them to a different folder and rename them. The folder structure is given below
Company 1(parent folder) North South East(sub folder) West(sub folder) Jan Feb Mar.... Dec Jan Feb Mar.... Dec Jan Feb Mar.... Dec Jan Feb Mar.... Dec
In the above structure, the files are present inside each folders Jan, feb...Dec under the regions North, South East n west. note that I have to select files starting with "Sales" and copy them into a new folder(say results) and rename copied files as Sales1.xls, Sales2.xls etc. (Files are not present in the folder company1, north, south, east and east.)
I have a excel file that I enter information into. I have code that saves the files to a certain folder with the name, date, and time stamp for the file name. At the end of the day I might have 3 to 15 excel files I have created that day and I would like to take information from certain cells (examle: L3, B6, B7, B8, G8, and so on) and create a txt file with all of the information in it.
Example: 12/20/2007 Your Name 123 Somewhere St. Here, OH 45111 Home Visit
I have about 100 Excel files in one folder that need to be saved as text files. They can keep the same name, but simply need to be converted to text files. I'd like to use VBA for this and I can't find examples that do exactly that...or ones that my limited knowledge can handle.
Excel files exist in C:Source and ALL of them should be saved as text files in C:Destination. Maybe there is an easier way, but I thought for sure there was a routine I could use.
I have a directory which contains many files, they are all names based on their locations. eg. Burwood-File1.xls,Burwood-File2.xls,Burwood-File3.xls etc
I have a master that which will contain the branch in the first column.
I have defined the directory location in a separate sheet as well as email template.
When I click on the Send Email button I want ti to attach the files that match the Branch name.
I have 8 different files all have a set of data in them
each one has a long list of (column a-n) however the number of rows change by date. I need each file copied into the finalfile.xls one after another. in the files that will be merged into the final file the final row i need copied is blank. I have all the copy formulas and everything set, I just need a range to copy that automaticaly takes cell a10 to the first blank a cell from each file and pastes it in the finalfile.xls under the last paste so they dont over write each other.
I have one main Excel file with information (in example file - columns A & B). I want to create 4 other Excel files that will draw from the main one (in example file - columns D, F, H, & J). I want the information in Excel file A, B, C, and D to be continuous information that matches the main file. For example, the letter A matches up with numbers 1,3,4,10,11,13,15,17, and 19 in the main file. When I open Excel file A, I want a continuous list of these numbers. And I want this for all 4 Excel files which draw from the main one.
So, today my manager came to me and informed me that he wanted me to do a little data entry for him... WOW... So I have about 2000 invoices to go through(all excel files, in their dated folders... 12-2-2013(folder) and the filenames are 12-2-2013(1), 12-2-2013(2) etc.)
I need to take these individual files and have certain cells from each in certain cells of a new workbook for example...
file 12-2-2013(1)... I need cell C3 from that file to go to cell A2(and this will be the same for all the other files... 12-2-2013(2) cell C3 needs to be in A3 etc etc etc.. this is the sale date) file 12-2-2013(1)... I need cell a15 and b15(they are both "stretched out" cells) to be put in C3 of the new workbook and so on.
is there an easy way/formula to do this all? I have to have this done by friday at the latest(tomorrow preferred @@) I have to input data for 7 cells...
I need to create a dynamic template for importing data from multiple .txt files to my workbook on a daily basis.
I recorded the macro for importing ONE txt files and starting to deveop it into looping through multiple txt files and sheets but to no avail.
1) Currently I have 4 named ranges
FileLocation = Location of my source file FileName = All the file names of my txt files SheetDestination = The sheet to be paste for each txt file (further explaination below) FileFormat = .txt (for VBA purpose)
2) The macro recorded was in "ActiveSheet", thus I thought of looping through each sheet (put the activate code at the first line) for the codes to run.
3) ColA ColB 1SP.txt 2IND.txt 3US.txt 4 5 6
Column A is my SheetDestination, while Column B is the respective filename for source txt file. My final intended result would be simply macthing sheet 1 against SP, sheet 2 against IND, sheet 3 against US... so on and so forth....
I have an excel file for each day of the month. Each file has 2 sheets for sure and some files have 3. I want to make one master file at the end of the month that shows all sheets. *1st sheet is master report. 2nd & 3rd sheets are created as a pivot table.
I'm currently using this script to download over 400 txt files which are needed for a project here at work. It works great, however, it will download the ftp files in question (which it gets a list of from another tab) in order. I would like a way to either download all 400 ato nce, or in a batch of 50 or even 100. As it is, the procedure takes around 70 mins to complete. I was hoping of a way to speed it up.
Here is the script I am using.
VB: Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean Dim lngRetVal As Long lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
I need to rename a large number of .pdf files. I have a list of the current file names in column A and the desired file names in column B.
Data in excel sheet1:
Current NameDesired Name AAA-BBB-001.PDFAAA-BBB-001-Description.PDF AAA-BBB-002.PDFAAA-BBB-002-Description.PDF AAA-BBB-003.PDFAAA-BBB-003-Description.PDF AAA-BBB-004.PDFAAA-BBB-004-Description.PDF AAA-BBB-005.PDFAAA-BBB-005-Description.PDF
I keep them in the destination folder below:
C:UsersmeDesktopA
I prefer to use an excel macro since I can't install any additional software on my work computer.
I have part of macro to import a txt file into excel but it is not working as it should. It is giving me a message "This file is not a recognizable format" but its just a normal txt file. Also after it gives me this warning it will open in excel and with every new txt file it gives me this warning and after it opens it.
The code I am using is:
Sub su() Dim oWbk As Workbook Dim sFil As String Dim sPath As String sPath = "C:Historical" 'location of files ChDir sPath sFil = Dir("*.txt") 'change or add formats Do While sFil "" 'will start LOOP until all files in folder sPath have been looped through Set oWbk = Workbooks.Open(sPath & "" & sFil) 'opens the file Workbooks.OpenText (sPath & "" & sFil), Comma:=True, DataType:=xlDelimited ' do something sFil = Dir Loop ' End of LOOP End Sub
In this line it gives me Runtime error 1004 Method 'Opentext' of object workbook failed: Workbooks.OpenText (sPath & "" & sFil), Comma:=True, DataType:=xlDelimited
I need to import about 1500 HTML file into a DB (SQL Server). But (here is the big problem), I only need to import some data of each HTML file (always the same line/variable).
So I thought using Excel as you can say with part of the HTML file you want to import. It works great.
But I did it with one file. Is there a way you can select a whole directory and it does it for you?
I send out 300 or so spreadsheets. The spreadsheet contains lines of products that recipients have on hire. Column L allows to the user to put YES or NO on each line, to state whether it is correct or not. The user then sends this sheet back.
The difficult part for me is I have to open each spreadsheet, and deal with all the instances of NO in column L. It takes almost a day to go through every spreadsheet.
Is it at all possible to have some sort of macro, VBA sript or access front page, that allows me to search all instances of 'NO' in all the spreadsheets which are in 1 designated folder?
Hopefully I am making sense in what Im after.. ideally I'd need a button on a spreadsheet that I click to give me all rows that contain NO in column L.
All the file names will be constant each week. (so each file name will be 01 - Hire List.xls, 02-Hire List.xls, 03-Hire List.xls etc etc).
I was to combine 130 files into one file without having to open all the files, if it's possible if not, then I guess I'll have to open them up. All Files have the same number of columns but difference number of rows.
I have to apply formulas to many different excel files. They are all seperate, and there are litterally thousands of them. They are all seperated, cause each of them represent and individual user.
I am unsure of how to work on so many files. I cannot select all of them to open at once either, cause they are in different folders.
I need some sort of batch running program, that could go thru each and every one of them, and apply some formulas to them (probably using VBA scripts)
I have used the 'VLOOKUP' function many times with success (eventually), but this time I might not be able to do what I want.
So, my question is this: using VLOOKUP, can I lookup 2 or more different table arrays in the 1 formula?
What I have is a member database of 140,000 , they all have a unique member ID number (eg. APL098829) and the program that contains these members has them broken down into 300+ .csv files (eg. APL_001.csv, APL_002, APL_003, etc)
When they come to an event their card is scanned. The members in my area are usually around the same numbers (ie. APL_097, APL_098). So this is why I would like to search these 2 database for their member ID and Return their name.
Not sure if this makes sense, after all it's 0150am here and I think I have nodded off a couple of times writing this.
I have searched for the Runtime Error 13 in the archives and tried a few things that was suggested such as: If I change the Variables Dim FName as a String for instance it then errors in the middle bold area "If IsArray(FName) Then" as a Compile Error - Expected Array. I tried deleting the Option Explicit but that didn't do anything.
If I comment out the If FName = "False" Then routine it works.. however *that* is in there because if the user hits Cancel on the Getopenfilename box, it will just continue with the rest of the process. If the user hits cancel, I want it to stop, but since this code is in a module, it will kick back to the calling Userform sub and thats how it continues to run. The label caption change is setting a label caption to "cancel" if cancel was selected on the get openfilename dialog to exit out of all the UserForm Subs, Is there a way to pass a variable from a module to a userform?
Option Explicit Sub GetData_Example5() Dim SaveDriveDir As String, MyPath As String Dim FName As Variant, N As Long Dim rnum As Long, destrange As Range Dim sh As Worksheet Dim wsNew As Worksheet SaveDriveDir = CurDir MyPath = Application.DefaultFilePath 'or use "C:Data" ChDrive MyPath ChDir MyPath FName = Application.GetOpenFilename(filefilter:="Excel Files,*.xls", _ MultiSelect:=True) If FName = "False" Then ' They pressed Cancel ' Set Label Caption as Cancel so rest of routine can be Canceled UserForm14.Label24.Caption = "Cancel".......................
i have this code below that opens a prn file. What i want it to do now is to open the next prn file within the folder. I want it to continue until it opens all of them in the folder.
i have a master file which needs to be updated by several other sourcefiles. I did a macro running from the master file which opens all of the sourcefiles one by one, copies the relevant info from the sourcefile to the masterfile, and closes the sourcefile, then moves to the other one. i know this is probably not the case, but the code below seems to behave randomly: sometimes it works, sometimes it bugs by saying file not found runtime error 1004:
Dim masterfile As String masterfile = "Master.xls" Dim sourcefile As String CurrentWeek = InputBox("Enter current week number") CountWk = 35 sourcefile = "Source" & CountWk Workbooks.Open (sourcefile) ....
The last statement causes the error. Both master.xls and source35.xls are in the same folder.
I have a question regarding importing data. What I need to do is specify a certain directory and this directory contains multiple Excel files. I would like to open each file and extract certain data from each workbook. I should be ok to figure that part out (the data extraction) but I am really confused on how to open each excel file in the directory.
I've 2 excel files open. The first with my data, and a second with a huge range. I need to work with a macro that used vlookup to get a value from the second file in the first.
My code:
VB: Sub mysub()
Dim i As Integer Dim y As Integer Dim match As String Dim no_match As Integer Dim rng As Range 'Set rng = Workbooks("wb2").Worksheets("Sheet1").Range("$A$1:$B$2704")
I have a folder that contains around 45 excel files, each of these files contain a tab called "corp val". (these files change name month to month e.g. Report June, Report July etc)
I am finding on a monthly basis i need to go into each of these excel files and copy the data from the "corp val" tab into a summarized spreadsheet - which i then use the data for various things.
Just wondered if there was a solution to this or will it always be difficult to copy and pasting all the data i need. I am not in anyway an advanced excel user, I am guessing this might be some form of macro in which case I am maybe better to keep doing it the way I was as I am not literate in macros.
I have a workbook that contains over 100 worksheets with stock data and price information. It uses a screenscraper to update the workbook each day with the latest day's price, and then exports each of these .csv files into a local directory. The macro for this is working. In effect it is generating a price history file automatically in my absence for me that can be read by charting software.
What I would like though is a macro to loopthrough and backfill missing price histories on each worksheet. I have a source of .csv price histories already, but would like to avoid having to cut and paste each of the 105 files manually, as it may become a regular occurence.
Each worksheet that requires backfilling has the stock code in the cell "A2", so that can be used to search for the filename Range("A2") & ".csv"
This is as far as I have got - however it results in a runtime error (91) Object variable or With block variable not set, pointing to this line:-
I have a spreadsheet with sales information contained in Sheet1. There are a number of columns including the Region column. I would like a bit of code that exports sales information to a number of Excel files dependent upon the region column. In other words the Region column can contain either North, East, South or West. I would like a different Excel file per region and I'd also like the file names to contain the name of the region + the month and year of the previous month ie if i was exporting today then the North Excel file would be called: "North Sales - Jan 2013".
I'm getting an input string from the user in an excel sheet(e.g. input.xls) .I have to search for that string in a group of excel files present in the same folder in which the input.xls file also present.The range of that cell in which the string is found (e.g. A1 ) has to be stored in a variable.
I know that Vlookup is an option but the number of excel files to be searched is more that 50.
I am troubleshooting my macro that seems to cause a data shift with the Letter "F" when I import multiple CSV files into one spreadsheet. When I go outside of the macro and record a macro and import the CSV into a workbook it works perfectly fine. But there must be something in this code that is causing the shift:
VB: Private Declare Function SetCurrentDirectoryA Lib _ "kernel32" (ByVal lpPathName As String) As Long Public Function ChDirNet(szPath As String) As Boolean Dim lReturn As Long lReturn = SetCurrentDirectoryA(szPath)
[Code] ....
I have attached an excel workbook that shows how the macro imports vs. a regular import. Why "F" is causing a shift in the data.