PC Review


Reply
Thread Tools Rate Thread

Delete rows that don't meet specific criterion

 
 
=?Utf-8?B?U0lUQ0ZhblRO?=
Guest
Posts: n/a
 
      4th Jun 2006
I have a huge report that lists information for many days. I want to delete
all rows that don't meet the criteria of todays date in column B. I also
want to only keep rows that have todays date with F800 in column D. I plan
on putting this code in a macro. Thanks so much....happy summer!!!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U0lUQ0ZhblRO?=
Guest
Posts: n/a
 
      4th Jun 2006
Thanks Ron, this look pretty complex....I'll add it to my macro and let you
know how it goes. One more question...my date, do I have to specificy a
format for it or will the code read any format for todays date. Thanks so
much, if this works it will be a huge time saver for my folks. I appreciate
all your time and effort.

"Ron de Bruin" wrote:

> Hi
>
> Test this one
>
> Sub Example1()
> Dim Firstrow As Long
> Dim Lastrow As Long
> Dim Lrow As Long
> Dim CalcMode As Long
> Dim ViewMode As Long
>
> With Application
> CalcMode = .Calculation
> .Calculation = xlCalculationManual
> .ScreenUpdating = False
> End With
>
> ViewMode = ActiveWindow.View
> ActiveWindow.View = xlNormalView
>
> Firstrow = ActiveSheet.UsedRange.Cells(1).Row
> Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1
>
> With ActiveSheet
> .DisplayPageBreaks = False
> For Lrow = Lastrow To Firstrow Step -1
>
> If .Cells(Lrow, "B").Value = Date And _
> .Cells(Lrow, "D").Value = "F800" Then .Rows(Lrow).Delete
>
>
> Next
> End With
>
> ActiveWindow.View = ViewMode
> With Application
> .ScreenUpdating = True
> .Calculation = CalcMode
> End With
>
> End Sub
>
>
> --
> Regards Ron De Bruin
> http://www.rondebruin.nl
>
>
>
> "SITCFanTN" <(E-Mail Removed)> wrote in message news:8FDA7A28-5EC6-48E4-8DB6-(E-Mail Removed)...
> >I have a huge report that lists information for many days. I want to delete
> > all rows that don't meet the criteria of todays date in column B. I also
> > want to only keep rows that have todays date with F800 in column D. I plan
> > on putting this code in a macro. Thanks so much....happy summer!!!

>
>
>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      4th Jun 2006
See my other reply in this thread for a correct example

--
Regards Ron De Bruin
http://www.rondebruin.nl



"SITCFanTN" <(E-Mail Removed)> wrote in message news:225792D9-BA3B-43EB-8158-(E-Mail Removed)...
> Thanks Ron, this look pretty complex....I'll add it to my macro and let you
> know how it goes. One more question...my date, do I have to specificy a
> format for it or will the code read any format for todays date. Thanks so
> much, if this works it will be a huge time saver for my folks. I appreciate
> all your time and effort.
>
> "Ron de Bruin" wrote:
>
>> Hi
>>
>> Test this one
>>
>> Sub Example1()
>> Dim Firstrow As Long
>> Dim Lastrow As Long
>> Dim Lrow As Long
>> Dim CalcMode As Long
>> Dim ViewMode As Long
>>
>> With Application
>> CalcMode = .Calculation
>> .Calculation = xlCalculationManual
>> .ScreenUpdating = False
>> End With
>>
>> ViewMode = ActiveWindow.View
>> ActiveWindow.View = xlNormalView
>>
>> Firstrow = ActiveSheet.UsedRange.Cells(1).Row
>> Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1
>>
>> With ActiveSheet
>> .DisplayPageBreaks = False
>> For Lrow = Lastrow To Firstrow Step -1
>>
>> If .Cells(Lrow, "B").Value = Date And _
>> .Cells(Lrow, "D").Value = "F800" Then .Rows(Lrow).Delete
>>
>>
>> Next
>> End With
>>
>> ActiveWindow.View = ViewMode
>> With Application
>> .ScreenUpdating = True
>> .Calculation = CalcMode
>> End With
>>
>> End Sub
>>
>>
>> --
>> Regards Ron De Bruin
>> http://www.rondebruin.nl
>>
>>
>>
>> "SITCFanTN" <(E-Mail Removed)> wrote in message news:8FDA7A28-5EC6-48E4-8DB6-(E-Mail Removed)...
>> >I have a huge report that lists information for many days. I want to delete
>> > all rows that don't meet the criteria of todays date in column B. I also
>> > want to only keep rows that have todays date with F800 in column D. I plan
>> > on putting this code in a macro. Thanks so much....happy summer!!!

>>
>>
>>



 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      5th Jun 2006
Hi

Test this one

Sub Example1()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

Firstrow = ActiveSheet.UsedRange.Cells(1).Row
Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1

With ActiveSheet
.DisplayPageBreaks = False
For Lrow = Lastrow To Firstrow Step -1

If .Cells(Lrow, "B").Value = Date And _
.Cells(Lrow, "D").Value = "F800" Then .Rows(Lrow).Delete


Next
End With

ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub


--
Regards Ron De Bruin
http://www.rondebruin.nl



"SITCFanTN" <(E-Mail Removed)> wrote in message news:8FDA7A28-5EC6-48E4-8DB6-(E-Mail Removed)...
>I have a huge report that lists information for many days. I want to delete
> all rows that don't meet the criteria of todays date in column B. I also
> want to only keep rows that have todays date with F800 in column D. I plan
> on putting this code in a macro. Thanks so much....happy summer!!!



 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      5th Jun 2006
Oops do not read it good
Send you a new macro soon



--
Regards Ron De Bruin
http://www.rondebruin.nl



"SITCFanTN" <(E-Mail Removed)> wrote in message news:8FDA7A28-5EC6-48E4-8DB6-(E-Mail Removed)...
>I have a huge report that lists information for many days. I want to delete
> all rows that don't meet the criteria of todays date in column B. I also
> want to only keep rows that have todays date with F800 in column D. I plan
> on putting this code in a macro. Thanks so much....happy summer!!!



 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      5th Jun 2006
Try this

Sub Example2()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

Firstrow = ActiveSheet.UsedRange.Cells(1).Row
Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1

With ActiveSheet
.DisplayPageBreaks = False
For Lrow = Lastrow To Firstrow Step -1

If .Cells(Lrow, "B").Value = Date And _
.Cells(Lrow, "D").Value = "F800" Then
' do nothing
Else
.Rows(Lrow).Delete
End If

Next
End With

ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub



--
Regards Ron De Bruin
http://www.rondebruin.nl



"Ron de Bruin" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Oops do not read it good
> Send you a new macro soon
>
>
>
> --
> Regards Ron De Bruin
> http://www.rondebruin.nl
>
>
>
> "SITCFanTN" <(E-Mail Removed)> wrote in message news:8FDA7A28-5EC6-48E4-8DB6-(E-Mail Removed)...
>>I have a huge report that lists information for many days. I want to delete
>> all rows that don't meet the criteria of todays date in column B. I also
>> want to only keep rows that have todays date with F800 in column D. I plan
>> on putting this code in a macro. Thanks so much....happy summer!!!

>
>



 
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
Counting characters in multiple rows when rows meet specific criteria news.virginmedia.com Microsoft Excel Worksheet Functions 3 28th Jun 2008 09:03 PM
Delete rows that do not meet specific criteria =?Utf-8?B?U0lUQ0ZhblRO?= Microsoft Excel Programming 3 6th Jun 2006 04:36 PM
How do I get the number of rows that meet an autofilter criterion. =?Utf-8?B?aGFrbw==?= Microsoft Excel Worksheet Functions 4 19th Nov 2004 04:09 PM
Re: Including rows in a calculation if they meet a criterion Domenic Microsoft Excel Worksheet Functions 0 3rd Jun 2004 04:21 PM
Re: macro to delete rows that meet specific condtions Bernie Deitrick Microsoft Excel Worksheet Functions 0 4th Sep 2003 02:35 PM


Features
 

Advertising
 

Newsgroups
 


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