Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub DeleteAllBut()
Dim myRange As Range Dim Date1 As Date Dim Date2 As Date Dim NumRows As Integer Dim Counter As Integer Set myRange = Range("D2:D" & ActiveSheet.Range("D65536").End(xlUp).Row) NumRows = myRange.Rows.Count 'No error checking here. If you put in a weird date, Excel will try to interpret 'whatever you type in and you could end up deleting everything. Date1 = InputBox("Enter starting date: ", "Starting Date") Date2 = InputBox("Enter ending date: ", "Ending Date") For Counter = NumRows + 1 To 1 Step -1 If Range("D" & Counter).Value < Date1 Or Range("D" & Counter).Value Date2 Then Range("D" & Counter).EntireRow.Delete End If Next Counter End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating a pricing table - with 2 input fields. | Excel Discussion (Misc queries) | |||
Creating a PDF will fillable fields | Excel Discussion (Misc queries) | |||
Creating a number from different fields. | Excel Worksheet Functions | |||
Help Please! - Creating Function Calculated Fields within Pivot Tables | Excel Worksheet Functions | |||
Creating mandatory fields(cells)... | Excel Worksheet Functions |