Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have Columns A:G and many cells I want to delete entire Rows if the content
of the cell contaings certain word. So far I got this Macro, but it does not loop and I have to run it several times to get it right. is there any way I could run it once? Note: the code below looks at cell A2:G2 and deletes the whole Row Sub DeleteColumns() Dim i As Integer For i = 256 To 1 Step -1 If Cells(2, i).Text = "Subtotal of High" Or _ Cells(2, i).Text = "Subtotal of Extremely High" Or _ Cells(2, i).Text = "Subtotal of Average" Or _ Cells(2, i).Text = "Subtotal of Below Average" Or _ Cells(2, i).Text = "Subtotal of Above Average" Or _ Cells(2, i).Text = "Grand Total" Then Cells(2, i).EntireRow.Delete End If Next i End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200707/1 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
DO LOOP in VBA | Excel Discussion (Misc queries) | |||
help with a loop | Excel Discussion (Misc queries) | |||
Do Loop | Excel Worksheet Functions | |||
Do Loop | Excel Worksheet Functions | |||
Do Loop | Excel Worksheet Functions |