Splitting *.csv Files Into Batches
Aug 16, 2004
I have a number of csv files with 30,000 - 60,000 records.
I'm looking for some code which will split them into batches of 250 record batches.
Each file id named FY838A, FY838B, FY838C etc.
I need something which will open the file then copy the first row (Field names), open a new book and paste the headers.
Then cut the first 250 records, rows 2:251 and paste them into the new book.
I then need to save them as a *.csv
All are named BatchFY838A (then B, C, D for each one)
Here's the main bit I can't figure out:
I would like to create a destination folder for each file.
I already have a main folder:
say C:IncompInbox
but when each file is created I need to make a folder for it to sit in:
C:IncompInboxFY838AFY 1
C:IncompInboxFY838AFY 2
C:IncompInboxFY838AFY 3
C:IncompInboxFY838AFY 4
(I need to create the FY838@ folder then the destination ones after that)
Until there are no records left to batch. i.e. the code needs to stop when it's completed the list (each one has a different amount of records)
Additional. Along with this I have 3 Word.doc's which need to be placed in each of the above folders, can I do this at the same time)
The end result is to be 3 Word.doc's and a *.csv file in each folder, this is for a huge Mail Merge which is already coded, so each files content will be 4 documents with exactly the same names.
View 9 Replies
ADVERTISEMENT
Nov 1, 2013
Set up a quick piece of code to convert batches of .doc files to .pdfs
Question 1 : What is the proper syntax to add a filter to the FileDialog to only allow for .doc and .docx files
Code:
Sub DocTOpdf()
Dim s As Variant
Dim Res As Integer
Dim oWord As Object
[Code] .....
Question 2: It would seem that randomly when running the code a Run-time error -21467259 (80004005) occurs at
Code:
oWord.ActiveDocument.ExportAsFixedFormat OutputFileName:= _
s & ".pdf", ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForOnScreen, Range:= _
wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _
IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _
True, UseISO19005_1:=False
View 2 Replies
View Related
Jul 6, 2014
I have excel data file where the code can split the data into different xls file on the basis of country for first sheet only.
execute the code so as to create single country wise files for all sheets. i.e. file consisting of data with sheet A1,B1,C1. The present code works only for sheet A1 and it creates different files with data related to that country. I was looking for the output file with B1 and C1 as well for that country. Also new output file needs to be renamed just as of original one.
View 3 Replies
View Related
Oct 11, 2012
What I am trying to is to count the number of times a certain number or character appears (either on its own or in a batch of consecutive cells containing that number/character) in a column.An example might clarify things (for reasons of brevity I will write the columns in rows):
If a column looks like (each 1-digit numbers / characters being a consecutive cell) 0 0 X X 0 0 X and I am counting for X, then I should get 2. If my column is X X 0 X X 0 X 0 0, then I should get 3. If my column is 0 X X 0 0 X 0 then I should get 2. If my column is X X 0 X X 0 X then I should get 3. Is there a formula to perform that calculation?
View 1 Replies
View Related
Mar 12, 2013
What I am doing is setting up a product ratecard sheet to run with our CRM system in work.
Each product has 10 quantities, with 10 different prices, but each product must have the same product code running down in column A
I have thousands of products to put in to dont want to manually type each code in.
I am ok with Excel, but I can not program in VBA, so i am looking for a formula to use.
The code is ZTRA-00001, which will stay the same for 10 rows, then there will be a space of 1 row and the next code for the next 10 rows in the column would be ZTRA-00002 etc.
View 1 Replies
View Related
Apr 3, 2012
Use look up to check batches of data a return a value dependent of multiple ifs?
I have this formula from here
=LOOKUP(COUNTIF(C4:C7,""&0),{0,1,2,3},{19.9,29.9,39.9,49.9})
What I am trying to achieve is using the above can it check
C4:C7 Grouped and named "first"
C8:C10 Grouped and named "second"
C11:C13 Grouped and named "third"
If one from each group is selected it returns 1 value, if 2 of each are selected it returns a second value and if 3 of each are selected it returns a third value?
I thought by grouping them it may give me the desired results but all it does is change if I select more than one from any of the groups.
View 2 Replies
View Related
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
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
Apr 11, 2014
I need some formula how to sum data with different format (general & $ (currency), splitting summing,
check this below :
<style type="text/css">
table.tableizer-table {
border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif
font-size: 12px;
[Code] .....
View 4 Replies
View Related
Feb 2, 2009
If I have a varying number of figures(say between 4 and 10) which I want the average of the first half of the set and an average of the second half, is there a function which I can use to calculate this? ie if there is 8 numbers in total then I need the average of the first four and last four... but if there is ten figures total then I need the average of the first five and last five.
View 2 Replies
View Related
Jan 23, 2007
If I have a string which contains 3 words, is there an easy way of separating out the consonants into one string and the vowels into another (spaces should be ignored)?
The only way I can think of doing it is to go through the string item by item and comparing the letters to a list of vowels and using that to do the separation.
View 9 Replies
View Related
Jun 18, 2007
I have text of varying length that I need to split up into three fields. I am using a vba code (kindly shown to me on a previous post) to split the first word, but in this particular macro I need to remove the last word. This is the code that I have at present which is displaying the first word.
Sub splitDescription()
Dim c As Range, t
For Each c In Range("e2:e" & Range("e" & Rows.Count).End(xlUp).Row)
t = Split(c)
c.Offset(, 1) = t(0)
Next
End Sub
The data I am trying to split consists of descriptions of varying lengths and I need to remove the first word and the last word and keep the middle text. Below is an example
SUEDE ROUCHED TRIM COURT GOLD
LEATHER/PATEN METALLIC SNAKE COURT BLACK
SUEDE RIBBONED BOW PURPLE
View 9 Replies
View Related
Dec 10, 2007
I have a To-do list of tasks in column A.
I want to split it up into assignments for different days of the week. I've labeled columns B thru F as Monday thru Friday and I want to split the list into blocks for those days.
Right now I have 54 items and I want my block size to be 12 items, which gives me 4 blocks of 12 and 1 block of 6 - can I make Excel do the splits for me?
View 9 Replies
View Related
Feb 15, 2009
The line below was originally a merged cell. I need to have the customer ID, Customer name, City, State and zip in seperate lines. I tried using the text to column, but the problem is some companies have a comma after their name to show if it is an llc or inc etc. What happens is the companies that do not have inc etc- it works just fine, however the ones that do have inc etc because there is another comma- it moves everything over one column. In the city column it says inc and in the state it has the city etc. Is there an easy way to make this work?
View 9 Replies
View Related
Jun 29, 2009
I have a spreadsheet I'm designing which requires me to take a series of numbers and return them lowest to highest. That's the easy bit.
The problem is where and how these numbers are displayed. They are not listed easily in two columns with the numbers in one column and someone's name against each one, but rather in four columns mapping out the odds and evens.
For example
1 Bob 2 Keith
3 Linda 4 Martin
Now obviously it'd be easiest if I could just re-format things into two columns, but that's not an option. However I'm finding myself a bit stuck when it comes to using an array in a formula.
I still want to return the names next to number, but I'm not sure how to have what's effectively a multiple array (or search two arrays at the same time). I'm looking to search the cells A1:A2 and C1:C2 in the example above, but not the cells B1:B2.
I just need to take the numbers in those cells A1:A2 and C1:C2 and list them in order highest to lowest.
View 9 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
Jul 28, 2014
How to split the data in my cells
Currently it looks like this.
1 - 2 - 3,4,5
A - B - C
I would like it to look like this.
1 - 2 - 3
1 - 2 - 4
1 - 2 - 5
A - B - C
View 6 Replies
View Related
Aug 11, 2014
Split the single into two, is this really possible in excel?To be precise dividing cell A1 into two different cells(No merging, No text to column option).
View 4 Replies
View Related
Mar 31, 2009
I have an address list that each address is in one cell. How can I seperate the address, city, state, and zip when they vary so much? I have included a sample from the list below.
320 PLUS PARK BLVD NASHVILLE TN 37217-1001
806 TWIN CITY AVE SPRINGDALE AR 72764-7083
1415 MURFREESBORO RD NASHVILLE TN 37217
300 WILMOT RD DEERFIELD IL 60015-4600
4325 AMNICOLA HWY CHATTANOOGA TN 37406-1014
2505 WEST PARWAY DRIVE RUSSELLVILLE AR 72801
675 PONCE DE LEON AVE NE ATLANTA GA 30308-1829
2035 N COLLEGE AVE FAYETTEVILLE AR 72703-2613
PO BOX 45009 SALT LAKE CTY UT 84145-0009
View 2 Replies
View Related
Aug 6, 2009
I have a spreadsheet which contains addresses split randomly into several columns and need to extract the postcode for every row.
WEST STREETCF34 9AF MAESTEG
DERWEN CLOSESA5 4QQ SWANSEA
GOETRE BELLAF ROADSA2 7RL SWANSEA
TALIESIN CLOSEBRIDGEND CF35 6JR
TALIESIN CLOSECF35 6JR BRIDGEEND
Above is a small example of 2 of the columns, most addresses are in 3 columns.
The postcode can appear at the front, end or anywhere in the address field. Depends on who typed it in. I need to somehow extract the postcode and have it in a separate column.
Text to columns wont work i think because the info isnt uniform, I've tried the search for the various postcode starting letters but still cannot extract the entire postcode.
View 10 Replies
View Related
Oct 28, 2013
I have a table of two columns, but I want them to be two separate but adjacent tables.
View 2 Replies
View Related
Dec 22, 2007
I need a macro which place chosen parts from one column into another column.
For example I have following text in column E:
Column E
Flugschneise {f}
ringsum
(total) im Arsch [vulg.]
mutterseelenallein
Geld und Gut
Pensum {n}
*chosen content not always at the end of a cell!
Now i need a macro which puts chosen content from Column E to Column F or Column G. For example I want that all “{f}s” should be deleted from column E and put into column E. Or I want all {n} to be deleted and placed into column F. Or I want all [vulg.] to be deleted from column E and put into column G. If column F or G already consist of text then the new text( {f} or {n} or [vulg.] ...) should be added to the existing text but separated through a separator like comma or semicolon …
It means that the macro is each time fed with information about what to delete from which column and where to put it. It would be cool if a simple msg box would ask for the needed information.
View 14 Replies
View Related
Jul 29, 2009
I'm currently working on a little project and at the moment it's my programmign skills letting me down lol, I'm litterally about to start pulling my hair out over not getting this to wokr. I extract data from my device which is in the following format.
View 14 Replies
View Related
Jul 4, 2008
I have to run payroll every two weeks, and part of the process involves calculating overtime for over 50 employees. The total amount of overtime hours for each employee is usually split on two or three budgets and after I calculate the budget splits, I have to enter these amounts into the payroll system. (The payroll system takes up to 2 decimal spaces.)
I have a spreadsheet set up for each employee, but what I've noticed is that the sum of the parts does not always equal the whole.
For example, Bob Goodworker worked 9 hours of overtime this pay period.
His budget split will be as follows:
Budget A (58.5%) = 5.27
Budget B (31.5%) = 2.84
Budget C (10%) = 0.90
However, 5.27 + 2.84 + .90 = 9.01
The payroll system only allows for numbers up to 2 decimal places.
View 10 Replies
View Related
Jul 28, 2008
How do I split the below character or similar strings into 2 columns of 25 characters each without cutting a word off?
BONE CURETTE-RVERSE ANGLE 5.5MM WIDTH-MEDIUM/BAYONETED
View 14 Replies
View Related
May 28, 2009
I know how to use concatenate but is there anything that will do the opposite. I want to take one cell that has both a date and time in it, and make the date in one cell and the time in another.
View 3 Replies
View Related