Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i need to create a macro to delete columns from my worksheet, which are
non-blank, and dont occur at an interval. what can be the way out for that? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can you read column titles into an array and apply your
delete/no-delete criteria based on their contents ? ruchie wrote: i need to create a macro to delete columns from my worksheet, which are non-blank, and dont occur at an interval. what can be the way out for that? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
since im sooo new to this, i dont know if i can do that or not. is it
possible that way? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Absolutely possible.. I use this type of subroutine to parse large
reports of columns that are not useful to me.. Start by creating a Title Row array of Column titles that you know are trash.. strTitles(1) = "Garbage" strTitles(2) = "more Garbage" strTitles(3) = "You get the idea" Next use a find subroutine to locate the Column and Row position of the expected Title. Sub FindMe(SearchWord) SearchRow = ActiveSheet.Cells.Find(SearchWord, LookIn:=xlValues, LookAt:= _ xlWhole).Row SearchCol = ActiveSheet.Cells.Find(SearchWord, LookIn:=xlValues, LookAt:= _ xlWhole).Column End Sub Then delete the column and advance to the next title to look for...... For z = 1 To IntLastCol Cells(TitlesRow(1), z).Select If IsError(Application.Match(ActiveCell.Value, strTitles, 0)) Then Range(Cells(TitlesRow(1), z), Cells(LastRow, z)).Select Selection.Delete Shift:=xlUp End If Next Note.. you don't want to assign all of the positions at the start since on delete your report will shift unless you use the [Selection.Delete Shift:=xlUp] function, thereby changing the location of the columns.. Test your code first by looking for the title you expect to remove then changing the Interior color.. you'll quickly know if your code is working as expected. HTH, Will ruchie wrote: since im sooo new to this, i dont know if i can do that or not. is it possible that way? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks a ton!
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting columns | Setting up and Configuration of Excel | |||
Adding Columns, Then deleting old columns | Excel Discussion (Misc queries) | |||
Combining Text from 2 Columns into 1 then Deleting the 2 Columns | Excel Worksheet Functions | |||
Deleting Columns | Excel Programming | |||
Deleting Columns | Excel Programming |