Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Row if Col. H contains either"Current Period" or"Year to Da
Hi,
I need to delete all rows if they contain either "Current Period" or"Year to Date" in Column H. The other Rows should move up accordingly. How do I change the code below to include "Year to Date" ??? Next i For i = 2 To n If Cells(i, 8) = "Current Period" Then Cells(i + 1, 8).Resize(1, 5).Cut Cells(i, 8) Rows(i + 1).Delete End If Next i Thanks, Manir |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Row if Col. H contains either"Current Period" or"Year to Da
manfareed,
If ((Cells(i, 8) = "Current Period") or (Cells(i, 8) = "Year to Date")) Then "manfareed" wrote: Hi, I need to delete all rows if they contain either "Current Period" or"Year to Date" in Column H. The other Rows should move up accordingly. How do I change the code below to include "Year to Date" ??? Next i For i = 2 To n If Cells(i, 8) = "Current Period" Then Cells(i + 1, 8).Resize(1, 5).Cut Cells(i, 8) Rows(i + 1).Delete End If Next i Thanks, Manir |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Row if Col. H contains either"Current Period" or"Year to Da
Manir,
Presuming the rest of your code works already, change :- If Cells(i, 8) = "Current Period" Then to: - If Cells(i, 8) = "Current Period" OR Cells(i, 8) = "Year to Date" Then hth, Tim "manfareed" wrote in message ... Hi, I need to delete all rows if they contain either "Current Period" or"Year to Date" in Column H. The other Rows should move up accordingly. How do I change the code below to include "Year to Date" ??? Next i For i = 2 To n If Cells(i, 8) = "Current Period" Then Cells(i + 1, 8).Resize(1, 5).Cut Cells(i, 8) Rows(i + 1).Delete End If Next i Thanks, Manir |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Row if Col. H contains either"Current Period" or"Year to Da
Sub rdel()
n = Cells(Rows.Count, "H").End(xlUp).Row For i = n To 1 Step -1 With Cells(i, "H") If .Value = "Current Period" Or .Value = "Year to Date" Then .EntireRow.Delete End If End With Next End Sub -- Gary''s Student - gsnu200748 "manfareed" wrote: Hi, I need to delete all rows if they contain either "Current Period" or"Year to Date" in Column H. The other Rows should move up accordingly. How do I change the code below to include "Year to Date" ??? Next i For i = 2 To n If Cells(i, 8) = "Current Period" Then Cells(i + 1, 8).Resize(1, 5).Cut Cells(i, 8) Rows(i + 1).Delete End If Next i Thanks, Manir |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Row if Col. H contains either"Current Period" or"Year to Da
Hi,
Thanks to all. All solutions work. Regards, Manir "manfareed" wrote: Hi, I need to delete all rows if they contain either "Current Period" or"Year to Date" in Column H. The other Rows should move up accordingly. How do I change the code below to include "Year to Date" ??? Next i For i = 2 To n If Cells(i, 8) = "Current Period" Then Cells(i + 1, 8).Resize(1, 5).Cut Cells(i, 8) Rows(i + 1).Delete End If Next i Thanks, Manir |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Functions for "current" & "previous" month to calculate data | Excel Worksheet Functions | |||
Excel "Move or Copy" and "Delete" sheet functions | Excel Worksheet Functions | |||
Working out age from "Day" "Month" "Year" | Excel Worksheet Functions | |||
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc | Excel Programming |