Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to optimize column deletion in a large table of data

Given some very large .csv files (200,000+ rows x 200 columns),
how would one optimize the deletion of a series of disjoint columns.
For example, what would be the best way to delete the following columns:
column1, 3, 8, 9, 10, 23, 24, 67, 89, 95
from a table with 200,000 rows?

Currently, I read the .csv file into Excel,
create a table,
set
Application.ScreenUpdating = False
Application.DisplayAlerts = False
then I call
table.ListColumns(columnName).Delete
for each columnName I want to delete.
then set
Application.ScreenUpdating = True
Application.DisplayAlerts = True

However, .Delete is an expensive operation and takes about 15-20 seconds
to complete the deletion of each column. Is there a better way
to delete a series of disjoint columns?


Any help is appreciated.
Tom

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default How to optimize column deletion in a large table of data

Hi

Maybe this will help you:

dim ColsToDelete as Range
Set ColsToDelete = Union(Columns(3), Columns(8), Columns(9))
Table.ListColumns(ColsToDelete).Delete

Regards,
Per

On 13 Okt., 22:21, TomChm wrote:
Given some very large .csv files (200,000+ rows x 200 columns),
how would one optimize the deletion of a series of disjoint columns.
For example, what would be the best way to delete the following columns:
* * column1, 3, 8, 9, 10, 23, 24, 67, 89, 95
from a table with 200,000 rows?

Currently, I read the .csv file into Excel,
create a table,
set
* * * * Application.ScreenUpdating = False
* * * * Application.DisplayAlerts = False
then I call
* * * * table.ListColumns(columnName).Delete
for each columnName I want to delete.
then set
* * * * Application.ScreenUpdating = True
* * * * Application.DisplayAlerts = True

However, .Delete is an expensive operation and takes about 15-20 seconds
to complete the deletion of each column. *Is there a better way
to delete a series of disjoint columns? *

Any help is appreciated.
Tom


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default How to optimize column deletion in a large table of data

Tom
Maybe something like this:
Range("B:B,D:D,F:F").Delete
Just add the columns you want. HTH Otto
"TomChm" wrote in message
...
Given some very large .csv files (200,000+ rows x 200 columns),
how would one optimize the deletion of a series of disjoint columns.
For example, what would be the best way to delete the following columns:
column1, 3, 8, 9, 10, 23, 24, 67, 89, 95
from a table with 200,000 rows?

Currently, I read the .csv file into Excel,
create a table,
set
Application.ScreenUpdating = False
Application.DisplayAlerts = False
then I call
table.ListColumns(columnName).Delete
for each columnName I want to delete.
then set
Application.ScreenUpdating = True
Application.DisplayAlerts = True

However, .Delete is an expensive operation and takes about 15-20 seconds
to complete the deletion of each column. Is there a better way
to delete a series of disjoint columns?


Any help is appreciated.
Tom



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to optimize column deletion in a large table of data

'columns 1, 3, 8, 9, 10, 23, 24, 67, 89, 95
ActiveSheet.Range("a1,c1,h1:j1,w1:x1,bo1,ck1,cq1") .EntireColumn.Delete

Do this before you create the table.

TomChm wrote:

Given some very large .csv files (200,000+ rows x 200 columns),
how would one optimize the deletion of a series of disjoint columns.
For example, what would be the best way to delete the following columns:
column1, 3, 8, 9, 10, 23, 24, 67, 89, 95
from a table with 200,000 rows?

Currently, I read the .csv file into Excel,
create a table,
set
Application.ScreenUpdating = False
Application.DisplayAlerts = False
then I call
table.ListColumns(columnName).Delete
for each columnName I want to delete.
then set
Application.ScreenUpdating = True
Application.DisplayAlerts = True

However, .Delete is an expensive operation and takes about 15-20 seconds
to complete the deletion of each column. Is there a better way
to delete a series of disjoint columns?

Any help is appreciated.
Tom


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to optimize column deletion in a large table of data

Thanks, Per, Otto and Dave for your quick replies.

@Per - I got "subscript out of bounds", when i tried using
Union on table listcolumns.

@Dave - Sounds like there isn't a way to this with the Table Object? I was
afraid
of this. I try this out later tonight.

Tom



"TomChm" wrote:

Given some very large .csv files (200,000+ rows x 200 columns),
how would one optimize the deletion of a series of disjoint columns.
For example, what would be the best way to delete the following columns:
column1, 3, 8, 9, 10, 23, 24, 67, 89, 95
from a table with 200,000 rows?

Currently, I read the .csv file into Excel,
create a table,
set
Application.ScreenUpdating = False
Application.DisplayAlerts = False
then I call
table.ListColumns(columnName).Delete
for each columnName I want to delete.
then set
Application.ScreenUpdating = True
Application.DisplayAlerts = True

However, .Delete is an expensive operation and takes about 15-20 seconds
to complete the deletion of each column. Is there a better way
to delete a series of disjoint columns?


Any help is appreciated.
Tom



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to optimize column deletion in a large table of data

I didn't try it in xl2007.

But it failed when I used xl2003's List (insert|List)



TomChm wrote:

Thanks, Per, Otto and Dave for your quick replies.

@Per - I got "subscript out of bounds", when i tried using
Union on table listcolumns.

@Dave - Sounds like there isn't a way to this with the Table Object? I was
afraid
of this. I try this out later tonight.

Tom

"TomChm" wrote:

Given some very large .csv files (200,000+ rows x 200 columns),
how would one optimize the deletion of a series of disjoint columns.
For example, what would be the best way to delete the following columns:
column1, 3, 8, 9, 10, 23, 24, 67, 89, 95
from a table with 200,000 rows?

Currently, I read the .csv file into Excel,
create a table,
set
Application.ScreenUpdating = False
Application.DisplayAlerts = False
then I call
table.ListColumns(columnName).Delete
for each columnName I want to delete.
then set
Application.ScreenUpdating = True
Application.DisplayAlerts = True

However, .Delete is an expensive operation and takes about 15-20 seconds
to complete the deletion of each column. Is there a better way
to delete a series of disjoint columns?


Any help is appreciated.
Tom


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to optimize? large non-contig cell range for data validation l ker_01 Excel Discussion (Misc queries) 5 May 1st 09 11:05 AM
How can I create one column (stacked) from a large table of data.. Jacko Excel Worksheet Functions 1 January 17th 08 07:50 PM
large data file problems - pivot table with vba [email protected] Excel Programming 0 July 29th 05 02:30 AM
calculations in large data set and in pivot table Adam Nichols Excel Programming 0 July 13th 04 10:59 PM
organizing a large amount of data into a table oakman[_9_] Excel Programming 2 May 22nd 04 02:27 AM


All times are GMT +1. The time now is 06:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"