Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to delete the rows with a positive number in a specific column. The
recordset will vary each time it is run. How do i change the range? Sub click() Dim i As Integer Sheet1.Select Sheet1.Range("a2:b6").Select For i = 2 To 6 Cells(i, 2).Select If Sheet1.Cells(i, 2) 0 Then Sheet1.Rows(i).Delete Next i End Sub Exit Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It depends on what the criteria for the recordset is. Here is a
solution assuming you want the macro to operate on the value in the first column of the selected range: Sub click() Dim i As Long With Selection For i = .Cells(1,1).Row + .Rows.Count - 1 to .Cells(1,1).Row Step - 1 If .Cells(i,1) 0 Then .Cells(i,1).EntireRow.Delete Next End With End Sub Charles Chickering marthasanchez wrote: I need to delete the rows with a positive number in a specific column. The recordset will vary each time it is run. How do i change the range? Sub click() Dim i As Integer Sheet1.Select Sheet1.Range("a2:b6").Select For i = 2 To 6 Cells(i, 2).Select If Sheet1.Cells(i, 2) 0 Then Sheet1.Rows(i).Delete Next i End Sub Exit Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can change range to select active rows instead of :=Range("S10 | Excel Discussion (Misc queries) | |||
How to populate Excel Range from Access RecordSet? | Excel Programming | |||
Creating a recordset over a range | Excel Programming | |||
Type recordset/recordset? | Excel Programming | |||
open range (within workbook) as ado recordset - excel vba | Excel Programming |