PC Review


Reply
Thread Tools Rate Thread

Delete Row if Col. H contains either"Current Period" or"Year to Da

 
 
=?Utf-8?B?bWFuZmFyZWVk?=
Guest
Posts: n/a
 
      2nd Oct 2007
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 With Quote
 
 
 
 
=?Utf-8?B?SlJGb3Jt?=
Guest
Posts: n/a
 
      2nd Oct 2007
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

 
Reply With Quote
 
Tim
Guest
Posts: n/a
 
      2nd Oct 2007
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" <(E-Mail Removed)> wrote in message
news:3DAB4662-859E-4896-BE18-(E-Mail Removed)...
> 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 With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      2nd Oct 2007
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

 
Reply With Quote
 
=?Utf-8?B?bWFuZmFyZWVk?=
Guest
Posts: n/a
 
      3rd Oct 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Send To" > "Compressed (zipped) Folder" omitting folders startingwith period / full stop Aidan Whitehall Windows XP General 2 24th Jun 2009 07:13 AM
Display a "Date" or "Month" or "Year" in a report Larry Microsoft Access Reports 2 6th Aug 2008 10:55 PM
CPUID's PC Wizard 200X (where"X" is current year) John Corliss Freeware 9 30th May 2005 06:11 PM
Outlook 2002 SP3 -> Tasks -> Custom Filter -> Advanced - ignores condition/value "between"/"last year and next friday" pluto@jupiter.info Microsoft Outlook 1 27th Jan 2005 05:11 PM
Grayed out buttons use "current" "Default" and "Blank" NS Windows XP Internet Explorer 2 12th Nov 2003 08:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:07 PM.