Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Total newbie question here. I'd like some help with deleting entire rows based on multiple text conditions. In hunting around on the group, I snagged this macro, which will work for one text condition. How can I change it to make it select all cells on the sheet named Sheet2, look for multiple conditions and delete rows based on all of them in a single macro? Sub deleteWithI() For Each myCell In Selection If myCell = "I" Then myCell.EntireRow.Delete Next myCell End Sub TIA, Jocelyn |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub deleteWithMultiple()
Dim rng as Range, mycell as Range For Each myCell In Selection if mycell = "I" or mycell = "J" or mycell = "B" or _ mycell = "T" then if rng is nothing then set rng = mycell else set rng = Union(rng,mycell) end if End if Next myCell if not mycell is nothing then _ mycell.EntireRow.Delete End Sub -- Regards, Tom Ogilvy "Jocelyn" wrote in message om... Hi, Total newbie question here. I'd like some help with deleting entire rows based on multiple text conditions. In hunting around on the group, I snagged this macro, which will work for one text condition. How can I change it to make it select all cells on the sheet named Sheet2, look for multiple conditions and delete rows based on all of them in a single macro? Sub deleteWithI() For Each myCell In Selection If myCell = "I" Then myCell.EntireRow.Delete Next myCell End Sub TIA, Jocelyn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need Help with ActiveCell.EntireRow.Delete | Excel Discussion (Misc queries) | |||
Need Help with ActiveCell.EntireRow.Delete | Excel Discussion (Misc queries) | |||
delete entirerow if date more than 12months old | Excel Discussion (Misc queries) | |||
formula to fill text with multiple conditions | Excel Discussion (Misc queries) | |||
Combining Text from multiple cells under multiple conditions | Excel Worksheet Functions |