VBA - Carry Out Task On Set Of CSV Files - Return Values And Leave Files Untouched?
May 14, 2013
Trying to write a script to carry out a number of tasks but is there code to enable an Excel to look in a particular file for the list of csv files - carry out the tasks and return the appropriate values in the Excel sheet whilst leaving the original csv files untouched?
View 2 Replies
ADVERTISEMENT
Aug 16, 2013
i am working with a large data set of excel files . I need to format the sheets in a specified way . i have recorded a marco that does this . I now have the problem of creating an automatic loader that opens the files , carrys out my macro , then closes the files.
For example i have a folder X that has 10 files inside it. i would like to be able to load the first file , carry out the macro, close the file move it folder y . Then look back into Folder X , take the first file it see's , carry out the macro , close the file , move it folder y , the go back to folder x and carrying out this until all the files are done and stopping when the folder is empty
View 1 Replies
View Related
Jul 30, 2007
I do'nt know really my problem is regarding excel or with windows, actually stange thing starts happening, I open multiple excel files but only one general excel instance is showing on the task bar. If I need to switch between the file I have to minimise the one I am using and then select other to open it. Even shortcut Alt+Tab switch is not working to switch between the excel files.
View 9 Replies
View Related
Jun 26, 2009
Need a way to update a single master file. What happens right now is that the cost manager sends out one file to a lot of different project heads and then on having them return back to him he basically has to individually add in all the data. What i am trying to do is that he somehow carries on sending out the data as there are a lottt of projects and then on returning them they automatically update.
View 14 Replies
View Related
Jan 4, 2014
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.)
View 1 Replies
View Related
Jul 5, 2007
I want to allow users to place files (.jpg, .tif, .pdf, .pps etc) into a network folder and then have my program open each file and display it for 30 seconds then close the file and the application before opening the next file.
1. Set up a loop to get a directory listing of the folder and write the listing to a text file.
2. Open up the text file and get the next filename in it
3. Open the file in the associated application
4. Wait for 30 seconds (or some period of time) and then close the file
5. Repeat steps 2-4
DoIt = 1
While DoIt = 1
Open "C:TempList.txt" for output as #1
Print #1, Files In Folder
Close #1
Open "C:TempList.txt" for input as #2
while not eof(2)
Line input #2, MyFile
Display MyFile on screen
Wait for 30 seconds
Close MyFile and MyApplication that opened it
wend
Close #2
I can get the directory listing just fine with no problems
I can open the files in the associated application just fine with no problems.
with closing the application after 30 seconds or some period of time.
I need some code that will allow me to easily send it a filename and it will know how to close the file and the application that opened it.
View 9 Replies
View Related
Feb 8, 2009
I have an Excel application (Excel 2003) which is stored in the default Program Files folder by the Installer; for example: c:program fileszxchello.xls. The problem I am running into is this file opens as Read Only in Vista and this is interfering with the running of the application. There is no problem opening the file normally in Windows XP.
I have been able to narrow down the cause of this to the User Account Control system in Vista - if I turn OFF User Account Control, the Excel file opens normally and my application functions normally. Is there another option to open the Excel file without turning OFF User Account Control because some users may find it unacceptable to turn OFF this security feature. Ofcourse, one option is to install the application in another location, outside the Program Folder, and the file would open normally, but the Packaging Wizard that I am using to package the application does not allow me to install the application in any other location and thus, the application installs in the Program Folder and I am running into this problem of the Exel file opening as Read Only. Is there a way out of this situation where I can open the file normally (not as Read Only)?
View 5 Replies
View Related
Jul 13, 2006
I'm using the following code to import thousands of html files into my spreadsheet. The code is working fine. Since I am importing thousands of files, when there is no more space on my worksheet, the code stops with an error message. I want to make this code add another worksheet & continue importing the html files until there are no more files to import.
Sub Master_Importer()
Dim I As Long
Dim strFilename As String
Dim strPath As String
strPath = "file:///C:/Documents and Settings/c/Desktop/New Folder/"
With Application.FileSearch
.LookIn = "C:Documents and SettingscDesktopNew Folder"
.FileType = msoFileTypeAllFiles
.Execute
For I = 1 To .FoundFiles.Count
strFilename = Mid(.FoundFiles(I), InStrRev(.FoundFiles(I), "") + 1)
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & strPath & strFilename _ .......................
View 5 Replies
View Related
Dec 21, 2007
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
12/20/2007
Someone Else
345 Anywhere St.
There, OH 45211
Hospital Visit
View 9 Replies
View Related
May 28, 2014
I've got a macro that gets me a list of all files in a folder, however I need it to only return .xls files.
Code:
VB:
Sub List()
Dim objFSO As Object
Dim objFolder As Object
[Code]....
View 2 Replies
View Related
Apr 8, 2014
I is it possible to convert all comma separated text files in a single folder in to excel files. But the requirement is to have 2 sheets in each new file. first to be the full file - with all columns, and in the second sheet to keep only colum A B D G H K L M O P R S T V W from the first sheet. The second sheet name must be the same as the first one but without the first "wlist_" in the name.
One more thing. The third column in the second is called "COUL". there are short letters for colors in french
can they be converted with the sort in English like it goes:
NO = B
BA = W
RG = R
SO = P
JA = Y
BE = L
VE = GY
GR = G
VI = V
MA = BR
BJ = TA
OR = O
Here is a link to the both CSV and an example excel file with the end result. In this example i haven`t change the shorts for the colors. It takes me too much time with the find and replace function. And at the moment i`m really pushed from time.
[URL]
View 9 Replies
View Related
Apr 2, 2014
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)
View 4 Replies
View Related
Sep 15, 2009
I have a large number of .txt files that are comma separated files (but not saved with the .csv extension) that I need to convert to files with the .csv extension.
Is there an easy way to do this for all files in a given folder? Ideally, the files don't even need to be opened as they are are quite large in size (70MB+) and there are a lot of them (500+).
View 9 Replies
View Related
Sep 26, 2007
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.
View 4 Replies
View Related
Jan 23, 2008
I have 22 CSV files. I want to search each of those files for a specific text string (ie: "profile" or "description"). When the macro finds the word in any one of the CSV files I want it to copy that complete csv worksheet and paste it into an excel xls file.
how I can go about doing this. Not also that while vlookup is possible, its very time consuming if i have to do this 50 times over and each time the csv files have different file names. that is why i want to search within a file (each file has its own unique identifying text string)
View 2 Replies
View Related
Feb 4, 2010
I would like to check/search if (FileName As String) is still exists in its directory.
--Why as string: because I have a hidden kollom where the links to the files are in txt format.--
I can't write VBA But maybe I can sketch it?
View 14 Replies
View Related
Sep 21, 2007
I have a bunch of quotes in Excel format which have 5 columns ; Part number, Description, Qty, Cost, Total Cost, Unit List,Total List. I need a piece of code to open many excel files, look for a "part number" beginning with ED,DS,AP,MP or MDS and return the corresponding value in the "total cost" column then record the value in a separate spreadsheet.
View 2 Replies
View Related
Oct 26, 2006
I found a use for the “Looping Through Workbooks” code (recommended by Dave in my last thread - thanks Dave).
I have a number of small files in "C:Files" that I’d like to loop through and find a match with data from a Master (in another folder) workbook as follows.
1. Match columns ”C” of each of the files with column ”H” of the Master.
2. For each matching cells, insert data from column “I” of the Master (“ Date” field) to into col “D” for each row of the individual files (about 300 rows)
3. Save & Close the workbook and loop to the next one in that folder
All that's needed here is code to search, match & paste, to insert into Dave's "Looping Through Files" code.
View 9 Replies
View Related
Jul 27, 2008
i have this code which looks in a folder and moves all .csv files from folder into workbook. The code uses an Array.
If the code does not find a file in the folder (from the array) it returns an error. How can i modify this so that (if a file is not found from the array) then the code still continues without generating errors?
This is the ....
View 9 Replies
View Related
Apr 21, 2009
I have the code below. It openes all csv files within a folder, then delete rows depending on the value of a cell. Now it needs to save the file as a xls file ....
View 9 Replies
View Related
Dec 21, 2007
I would like to be able to execute a command line that will convert an Excel csv file to an Excel file that is TAB delimited. In other words, replace the comma delimiter with a TAB delimiter without having to open the file in Excel. I am an inexperienced Excel user
View 2 Replies
View Related
Apr 14, 2009
I have a file with some statistics on how agents at work performed. This file gets sent to all of them, but before we send it we change the names for a number, so that they don't know how the other agents are doing (avoiding comparisons). People had been doing this manually, but it's getting really complex as the number of agents is increasing. I know that this can be automatized, but I have no idea on how to do it. A simple formula with an IF statement wouldn't be sufficient. Here's an example of the data. The file that is to be modified to be sent to all the agents looks like this:
View 3 Replies
View Related
Jun 26, 2008
Is there a code that will search a pre-determined folder for all .xls files containing the word "Temp", and deleting those files?
Example:
In the root of drive M, I have several Excel files. Anytime one of the original tracking logs is opened, a temp file of that log is automatically created. I would like to automatically search the drive and delete all files containin the word "Temp".
I've attached a picture of the directory tree, in case that will help. The file will always be named "PO Response Tracking - Temp#######.xls", with ###### representing a series of either 5 or 6 numbers.
View 14 Replies
View Related
Jan 16, 2012
I have 4 different excel files in C:Reports (SupplierA.xls, SupplierB.xls, SupplierC.xls and SupplierD.xls) all with a page called "Summary" (like below) in a set range A2:F5.
Fruit
Monday
Tuesday
Wednesday
Thursday
Friday
Apples
2 4 1 7 8 Oranges
2 3 4 6 9 Lemons
4 5 6 6 6 Pears
1 2 3 5 5
I also have a summary excel file in C:Totals called "Supplier Totals" that has a summary page that I want to total up all my suppliers A, B, C and D (same as above A2:F2). How can do this in VBA?
I am using Excel 2007.
View 1 Replies
View Related
Mar 31, 2007
I have situation which needs expert advice. I have about 22 Excel files of different branches with similar data. I have to link some calculated cells from each of these files into one file to show the consolidated data. There are about 18 calculated cells in each file, so linking each one is practically impossible.
View 10 Replies
View Related
May 1, 2013
I'm trying to code a macro to search through all the files in certain folders to find a value defined by the user. The rows containing that value will then be copied and pasted into a separate workbook. My boss currently planning on storing about 550 different files (90 days worth of data) between these folders, but there is the possibility of years worth of data collection, should he change his mind about the 90 days, so I'd like the code to be efficient if possible. What I've tried to do is search each file for the value, then set a range equal the first row containing that value. If the value is found in that workbook, the code loops through the worksheet, adding all the other rows with that value to the range. Then the file looping exits (the values I'm looking for are only contained in one of the workbooks) and the range is copied and pasted into the master workbook. Each workbook has only one sheet.
I'm currently getting a run-time error "13" Type Mismatch error when it gets to the line where the code is supposed to find the value and initialize the range.
Code:
Private Sub SubmitButton_Click()
Dim mybook As Workbook
Dim masterbook As Workbook
Dim rownunm As Long
Dim pathparts(1 To 5) As String
[Code] ......
View 3 Replies
View Related
Feb 22, 2014
I have a few similar excel files in a specific folder (for my salesman to report their sales) - let's call those files "working files" I have another file (we'll call it "master file") in a different folder, where I update values in column A - and those values needs to appear in column B in all of the working files. it is necessary that each time the macro is been activate, it will "run over" the existing values in column B in the working files, and insert instead of them the update values from the master file.
View 1 Replies
View Related
Jul 31, 2008
1. For a file moving from one cell to the next, down the column, get the values and seach for the values in file number two.
2. If that value is found, copy a cell from file 1 to a cell of a column on the same row where the value was found on.
3. Do what was done on number two, but with a different column.
this is what i have so far...
Sub replace()
'
' Macro2 created by david
'
' for the entire sheet, moving from one cell to the next down the column, changing rows
' search for the contents in another sheet, and then if that is found,
' copy the row number to a variable, and then
' copy column K from sheet 1 to column N of sheet 2, using the same variable above
' after that same, but L goes to P.
'
'
Windows("file1.xls").Activate
Rng = Selection.Rows.Count
Dim toFind As String
ActiveCell.Offset(0, 0).Select
Application. ScreenUpdating = False
Dim i As Integer
For i = 1 To Rng
Windows("file1.xls").Activate
toFind = Range("A + i")
Windows("file2.xls").Activate
View 7 Replies
View Related
Sep 14, 2013
I need to create time sheets for about 30 contract workers.
Each time sheet needs to have their name as well the date for sunday of that week inserted into the form. (once the date for sunday is entered into the sheet, the rest of the dates for the week will be extrapolated out).
Then, once the data is inserted for a single worker, I need that file to be saved using the workers name in the file name.
The script would then open a new time sheet template, insert the second workers name and the date for sunday and save the file. Repeate for next 30 workers.
View 1 Replies
View Related
Jun 24, 2014
I need a formula (but most likely a VBA macro) that will search through a folder for a file than get data from that file. The files are named in systematic way, but I need the entire formula to work from inputting a mold number in one cell. E.g. I input 6291 in cell A2 the vba macro searches for file “6291 mold.xlsx” and returns a range of numbers as well as pictures in specified cells. Is this possible? If so how?
The closest thing I have found is VBA macro that retrieves a list of media files in a folder, I listed the code below.
[Code] ....
[URL] ....
View 3 Replies
View Related