Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Delete Columns

I have spreadsheet and 5 columns get deleted before I
import into a database. At first I just did a record
macro and deleted assuming the formatted would not
change. What I want to do is look for a specific name and
then delete the entire column. So if the columns are
named MGMTCODE, CHANNEL, NAME1, CLASS, FUND NAME Delete.
The column names always start in the first row A1. There
are about 20 columns in all ans some months they change
the order on me.

Any suggestions on how I can do this?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete Columns

Dim varr as Variant, i as long, res as Variant
varr = Array("MGMTCODE", "CHANNEL", "NAME1", "CLASS", "FUND NAME")

for i = lbound(varr) to ubound(varr)
res = Application.Match(varr(i),Rows(1),0)
if not iserror(res) then
columns(res).EntireColumn.Delete
end if
Next

--
Regards,
Tom Ogilvy

"Jean" wrote in message
...
I have spreadsheet and 5 columns get deleted before I
import into a database. At first I just did a record
macro and deleted assuming the formatted would not
change. What I want to do is look for a specific name and
then delete the entire column. So if the columns are
named MGMTCODE, CHANNEL, NAME1, CLASS, FUND NAME Delete.
The column names always start in the first row A1. There
are about 20 columns in all ans some months they change
the order on me.

Any suggestions on how I can do this?



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
delete columns if 0 jatman New Users to Excel 2 January 3rd 09 04:39 AM
merge text from 2 columns into 1 then delete the old 2 columns sleepindogg Excel Worksheet Functions 4 March 30th 06 07:25 PM
Can't delete columns Buss Excel Discussion (Misc queries) 3 December 16th 05 07:28 PM
I can't delete columns - help! dcleesfo Excel Worksheet Functions 3 September 16th 05 02:00 AM
Delete columns Elsie Excel Programming 1 February 28th 04 03:08 AM


All times are GMT +1. The time now is 08:24 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"