Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete rows if AF and AY empty but F has information | Excel Worksheet Functions | |||
Filter out rows of information in a list via VBA | Excel Discussion (Misc queries) | |||
Delete rows in a workbook that contain the same information | Excel Worksheet Functions | |||
sort and delete rows of information | Excel Discussion (Misc queries) | |||
Delete rows in filter view | Excel Worksheet Functions |