473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Sorting database and export it to excel in many sheets

20
I'm using Access and Excel 2003

Every month I receive a database with a column that has multiple dates, so, I need to group them and export every "group of same date", to a new sheet in excel in the same workbook

The problem are:
1Every month dates change
2When a "group of same date" have more than 65,536 lines I need to export it into a new sheet with the same name but adding a counter, example;
(01-01-2010 (1), 01-01-2010 (2), 01-01-2010(03), etc

I'm Know Vba, I have made already a macro that imports the Database to Acess as a table, next? I dont know
Feb 5 '10 #1
11 3268
Guido Geurs
767 Expert 512MB
dear,

Some questions:
Why via access ?
What type of file is the source ?
Why not import it in Excel and sort it there ?
Is it possible to attach an example of the source file?

br,
Feb 6 '10 #2
cynicon
20
Thanks for your Reply

Why via access ?
Because access is faster than excel when you manage files of about 200,000 records

What type of file is the source ?
txt

Why not import it in Excel and sort it there ?
I have already made a macro that does it in excel, but it is quite slow, it last about an hour running

Is it possible to attach an example of the source file?
Sure, this is a samble of 25 records, but original source file is about 200,000 records, the column I need to sort is entitled "Fecha de Aplicación Cuota Aceptada"

Thank you so much
Attached Files
File Type: txt FACTURACION_DICIEMBRE_ACE2.TXT (3.3 KB, 533 views)
Feb 9 '10 #3
Guido Geurs
767 Expert 512MB
dear,

I have received you demo file.

When you run your macro in Excel, is it like this (very slow)=

- reed all data
- check row 1 and sort it to the exact sheet
- check row 2 and sort it to the exact sheet
- check row 3 and sort it to the exact sheet
- check row 4 and sort it to the exact sheet
.....

or are you working in the memory (much faster)?
like:
- reed all data to an array
- sort the data in other array's
- dump all the data from the array's in the sheets

Because I think (I have no experience with such big files) that working in the memory with array's is much faster than jumping from sheet to sheet in Excel.

br,
Feb 9 '10 #4
cynicon
20
Thanks four your answer, so this is my excel vba code, Im pretty sure its not an array.
Attached Files
File Type: zip Importing Sheets 2.zip (17.8 KB, 130 views)
Feb 9 '10 #5
Guido Geurs
767 Expert 512MB
dear,

I have prepared a code with array's (see attachment).

To run : click the command button.

There are some checking in the code: if you want to use them, just uncomment them (delete the ' in front if it)

If you want to change the number if rows in each sheet, delete the ' in the line=

Expand|Select|Wrap|Line Numbers
  1. '      ROWS_IN_SH = 4
and change the number.

Please test this with a file with more lines than the one you have send me.
I hope the program is OK.

Later on I can make some modifications like sorting the DATES so the sheets are created in ascending order.

br,
Attached Files
File Type: zip EXCEL Sorting database and export in many sheets_v8.zip (36.8 KB, 132 views)
Feb 12 '10 #6
cynicon
20
Thank you so much, I have already use it, however it only works with the 25 records sample file, when I try to run it with the bigger one it doesnt make anything, so in the next link you can find the full archive, so you could figure out the problem, thank you so much for your answer

http://rcpt.yousendit.com/820139764/...1ac057a6c44e6b
Feb 15 '10 #7
Guido Geurs
767 Expert 512MB
dear,

The reading of the large file is OK but the splitting and finding the dates wont work because the TXT file you have send me has a "COMMA" as delimiter between the values (like the one you have send me as example) !

And the decimal numbers have also a comma in it so the splitting is NOT Ok.

Please can you try with a TXT file with ";" as delimiter between the values ?

If it not works please send me an ewample so I can test it with the program.

br,
Feb 16 '10 #8
cynicon
20
Oops!! Sorry, you are right

So here you can find the correct file, thank you so much


https://www.yousendit.com/download/R...UzhiV3gzZUE9PQ
Feb 17 '10 #9
Guido Geurs
767 Expert 512MB
dear,

Sorry for this late response but I think you can already guess it "Huston, we have a problem !".
The code I have is OK (see attachment) because it works fine for data files with 20.000 lines .
BUT: when I want to process files bigger than 50.000 lines, Excel blocks.
I have try-ed it on a PC Pentium4 2,6 MHz with 750 Mb of memory.

You will also see in the VBA that I have build in some control's to watch the evolution during the process.

It shows that for your file (with 192.000 lines) there is no problem to read it into the array.
Only when the filter starts, Excel stops at line 12 and the sheet is selected (not in the code).

I will see if I can find the cause fast.
If not, I will try to write a tool in VB6 which does the filtering and saves the data for each sheet in TXT files.
These TXT files can then be read into Excel (I hope) (maybe it's even faster than filtering in Excel).

br,
Attached Files
File Type: zip Sorting database and export in many sheets_v2.5.zip (29.7 KB, 74 views)
Feb 28 '10 #10
Guido Geurs
767 Expert 512MB
dear,

I think thisone will work. (see attachment)
One of the counters was dementioned as Integer and must be Long !
On my PC (Pentium 4 2.6 GHz 750 Mb memory) the File with 192.450 lines is imported and split in 40 min..

br,
Attached Files
File Type: zip Sorting database and export in many sheets_v2.9.zip (31.4 KB, 106 views)
Mar 7 '10 #11
cynicon
20
Ggeu,
Thank you so much, it works, perfect, I have no words to express how much I appreciate your help, Ill use it, thank you so much
Mar 8 '10 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

24
by: Michael Malinsky | last post by:
I'm attempting to create a database which will take information from one (perhaps two) tables and utilize that information to return queries to a report designed in Excel. The general idea I...
1
by: Chris | last post by:
Hi, I am using: DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, lcQueryName, strFilePathNamE, True ....to export my query data to an existing excel workbook. Then what i need...
4
by: sunilkeswani | last post by:
I need help with exporting data from 2 access tables, into 2 existing spreadsheets in a single Excel file. Currently, I am using this code: DoCmd.TransferSpreadsheet acExport, 8, "Table1",...
1
by: VK | last post by:
Hey, I have some nested datagrids, which I would like to export to a excel. Exporting is not a problem - however I would like to export the nested data into different sheets on the same excel...
1
by: Dianna | last post by:
Hi, I am using Response.ContentType = "application/vnd.ms-excel" to export an asp page to excel. Nice feature, however, it does not seem to like style sheets. Because of this, my excel file...
7
by: Vanessa | last post by:
hi Everyone, I have two questions on exporting data to Excel using ASP (w/o converting formatted excel file into web page and then plug in the dynamic data): 1. Can we export data into...
0
by: devolper | last post by:
I am devolping a web application which which .net reports to a excel work book .each report in one excel sheet.i am using the following code.......... Dim objDestinationExcel As New...
0
by: sandervanee | last post by:
Hello, I am trying to export several Access 2003 select queries to Excel 2003 using an Access macro. I'm using the macro command "TransferSpreadsheet" to export the queries. This going quit well,...
1
by: DennisBetten | last post by:
First of all, I need to give some credit to Mahesh Chand for providing me with an excellent basis to export data to excel. What does this code do: As the title says, this code is capable of...
2
hemantbasva
by: hemantbasva | last post by:
Note We need to have a template on server for generating report in multiple sheet as we do not had msoffice on server moreover this require a batch job to delete excel file created by the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.