Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete All Columns Except
Looking to create a macro that will erase all columns except where the
first cell (row a) contains the name: Eggs Cheese Salad Pizza |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete All Columns Except
Row 1?????
Option Explicit sub testme() dim iCol as long with activesheet for icol = .cells.specialcells(xlcelltypelastcell).column to 1 step -1 select case lcase(.cells(1,icol)) case is = "eggs","cheese","salad","pizza" 'do nothing, keep it case else .columns(icol).delete end select next icol end with end sub This assumes that there's nothing else in the cell except those names. "J.W. Aldridge" wrote: Looking to create a macro that will erase all columns except where the first cell (row a) contains the name: Eggs Cheese Salad Pizza -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
delete columns if 0 | New Users to Excel | |||
Delete Columns | 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) | |||
Delete columns | Excel Programming |