Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default I need to filter and delete rows of information between 2 dates

I have a spreadsheet with 12 columns of data and one column has dates. I
need a macro to delete out rows of information that are less than date1 and
greater than date2. Ihis will leave information that is greater than or
equal to date1 and less than or equal to date2. In the macro I need ask for
and get date1 and date2 for input from the user.

I tried recording the steps and inputing the date1 and date2 in certain
cells prior to this, but it did not duplicate it when I ran it again.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default I need to filter and delete rows of information between 2 dates

Hi lpdarspe

You can use EasyFilter to do this
http://www.rondebruin.nl/easyfilter.htm

Or do you want a macro ?


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


"lpdarspe" wrote in message ...
I have a spreadsheet with 12 columns of data and one column has dates. I
need a macro to delete out rows of information that are less than date1 and
greater than date2. Ihis will leave information that is greater than or
equal to date1 and less than or equal to date2. In the macro I need ask for
and get date1 and date2 for input from the user.

I tried recording the steps and inputing the date1 and date2 in certain
cells prior to this, but it did not duplicate it when I ran it again.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default I need to filter and delete rows of information between 2 date

Hello Ron,

I would like to have a macro.

Regards,

LPDARSPE

"Ron de Bruin" wrote:

Hi lpdarspe

You can use EasyFilter to do this
http://www.rondebruin.nl/easyfilter.htm

Or do you want a macro ?


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


"lpdarspe" wrote in message ...
I have a spreadsheet with 12 columns of data and one column has dates. I
need a macro to delete out rows of information that are less than date1 and
greater than date2. Ihis will leave information that is greater than or
equal to date1 and less than or equal to date2. In the macro I need ask for
and get date1 and date2 for input from the user.

I tried recording the steps and inputing the date1 and date2 in certain
cells prior to this, but it did not duplicate it when I ran it again.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default I need to filter and delete rows of information between 2 date

This is a small example

Do you use a userform to ask the user for the dates or do you want to use a inputbox ?
Remember that there must be a good error check to see if the user enter a real date

Sub Delete_with_Autofilter_Two_Criteria()
Dim DeleteValue1 As String
Dim DeleteValue2 As String
Dim rng As Range

DeleteValue1 = "<=1/10/2006"
DeleteValue2 = "=1/25/2006"
With ActiveSheet
.Range("A1:A100").AutoFilter Field:=1, Criteria1:=DeleteValue1, _
Operator:=xlAnd, Criteria2:=DeleteValue2
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete
End With
.AutoFilterMode = False
End With
End Sub


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


"lpdarspe" wrote in message ...
Hello Ron,

I would like to have a macro.

Regards,

LPDARSPE

"Ron de Bruin" wrote:

Hi lpdarspe

You can use EasyFilter to do this
http://www.rondebruin.nl/easyfilter.htm

Or do you want a macro ?


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


"lpdarspe" wrote in message ...
I have a spreadsheet with 12 columns of data and one column has dates. I
need a macro to delete out rows of information that are less than date1 and
greater than date2. Ihis will leave information that is greater than or
equal to date1 and less than or equal to date2. In the macro I need ask for
and get date1 and date2 for input from the user.

I tried recording the steps and inputing the date1 and date2 in certain
cells prior to this, but it did not duplicate it when I ran it again.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default I need to filter and delete rows of information between 2 date

Oops

xlOr

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


"Ron de Bruin" wrote in message ...
This is a small example

Do you use a userform to ask the user for the dates or do you want to use a inputbox ?
Remember that there must be a good error check to see if the user enter a real date

Sub Delete_with_Autofilter_Two_Criteria()
Dim DeleteValue1 As String
Dim DeleteValue2 As String
Dim rng As Range

DeleteValue1 = "<=1/10/2006"
DeleteValue2 = "=1/25/2006"
With ActiveSheet
.Range("A1:A100").AutoFilter Field:=1, Criteria1:=DeleteValue1, _
Operator:=xlAnd, Criteria2:=DeleteValue2
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete
End With
.AutoFilterMode = False
End With
End Sub


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


"lpdarspe" wrote in message ...
Hello Ron,

I would like to have a macro.

Regards,

LPDARSPE

"Ron de Bruin" wrote:

Hi lpdarspe

You can use EasyFilter to do this
http://www.rondebruin.nl/easyfilter.htm

Or do you want a macro ?


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


"lpdarspe" wrote in message ...
I have a spreadsheet with 12 columns of data and one column has dates. I
need a macro to delete out rows of information that are less than date1 and
greater than date2. Ihis will leave information that is greater than or
equal to date1 and less than or equal to date2. In the macro I need ask for
and get date1 and date2 for input from the user.

I tried recording the steps and inputing the date1 and date2 in certain
cells prior to this, but it did not duplicate it when I ran it again.









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default I need to filter and delete rows of information between 2 date

Thank you very much Ron!

How would all this work with an inputbox?

Best regards,

Lpdarspe

"Ron de Bruin" wrote:

Oops

xlOr

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


"Ron de Bruin" wrote in message ...
This is a small example

Do you use a userform to ask the user for the dates or do you want to use a inputbox ?
Remember that there must be a good error check to see if the user enter a real date

Sub Delete_with_Autofilter_Two_Criteria()
Dim DeleteValue1 As String
Dim DeleteValue2 As String
Dim rng As Range

DeleteValue1 = "<=1/10/2006"
DeleteValue2 = "=1/25/2006"
With ActiveSheet
.Range("A1:A100").AutoFilter Field:=1, Criteria1:=DeleteValue1, _
Operator:=xlAnd, Criteria2:=DeleteValue2
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete
End With
.AutoFilterMode = False
End With
End Sub


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


"lpdarspe" wrote in message ...
Hello Ron,

I would like to have a macro.

Regards,

LPDARSPE

"Ron de Bruin" wrote:

Hi lpdarspe

You can use EasyFilter to do this
http://www.rondebruin.nl/easyfilter.htm

Or do you want a macro ?


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


"lpdarspe" wrote in message ...
I have a spreadsheet with 12 columns of data and one column has dates. I
need a macro to delete out rows of information that are less than date1 and
greater than date2. Ihis will leave information that is greater than or
equal to date1 and less than or equal to date2. In the macro I need ask for
and get date1 and date2 for input from the user.

I tried recording the steps and inputing the date1 and date2 in certain
cells prior to this, but it did not duplicate it when I ran it again.








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete rows if AF and AY empty but F has information Louie Excel Worksheet Functions 6 March 4th 10 09:51 PM
Filter out rows of information in a list via VBA James C[_2_] Excel Discussion (Misc queries) 8 January 26th 10 05:08 PM
Delete rows in a workbook that contain the same information tiff Excel Worksheet Functions 2 February 19th 09 02:03 PM
sort and delete rows of information jlclyde Excel Discussion (Misc queries) 4 November 6th 08 04:29 PM
Delete rows in filter view Dakota Excel Worksheet Functions 1 March 22nd 06 02:50 PM


All times are GMT +1. The time now is 06:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"