Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
delete columns if 0 | New Users to Excel | |||
merge text from 2 columns into 1 then delete the old 2 columns | Excel Worksheet Functions | |||
Can't delete columns | Excel Discussion (Misc queries) | |||
I can't delete columns - help! | Excel Worksheet Functions | |||
Delete columns | Excel Programming |