Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm working in a huge excel spreadsheet (AA:EN). I need to delete all
but 15 columns. How can I create a macro which will search for the column name and then delete that entire column. Also if the column is not found how can I program the macro to move to the next search/delete? Anyway help would be greatly appreciated. So far this is what I have, but I want to delete the columns without specifying the Column location as these columns could be in different locations due to formating issues on another spread sheet. Cells.Find(What:="private label", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False).Activate Columns("A:A").Select Selection.Delete Shift:=xlToLeft Range("A1").Select Cells.Find(What:="alternate", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False).Activate Columns("D:D").Select Selection.Delete Shift:=xlToLeft Range("D12").Select Cells.Find(What:="purchase", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False).Activate Columns("E:E").Select Selection.Delete Shift:=xlToLeft Selection.Delete Shift:=xlToLeft End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
keyword search and delete row | Excel Discussion (Misc queries) | |||
Search & delete ANY text in select columns | Excel Discussion (Misc queries) | |||
Add-in to search and delete | Excel Programming | |||
Search and Delete | Excel Programming | |||
Macro to search, compare, copy and delete | Excel Programming |