View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Executor Executor is offline
external usenet poster
 
Posts: 74
Default Conditional deletion of rows

Hi AussieExcelUser

You can try this:


Sub DeleteRows()
Dim BeginRow As Integer
Dim EndRow As Integer
Dim LoopRow As Integer
Dim chkCol As Integer

BeginRow = 1
EndRow = ActiveSheet.UsedRange.Rows.Count ' To check all lines
chkCol = 6 ' The column with the values to check

For LoopRow = BeginRow To EndRow
If Not IsEmpty(Cells(LoopRow, chkCol)) Then
If Cells(LoopRow, chkCol).Value < 0 Then
Cells(LoopRow, chkCol).EntireRow.Delete = True
End If
End If
Next LoopRow
End Sub


HTH,

RadarEye.

AussieExcelUser wrote:
I need help on a macro (actually part of a master formatting macro) to
delete entire rows where the value in a cell in the row equals or is
less than zero. The reference cell is always in the same column.

Put simply, I need the macro to perform the "ctrl -" that I would do
manually.

Any help would be great.


--
AussieExcelUser
------------------------------------------------------------------------
AussieExcelUser's Profile: http://www.excelforum.com/member.php...o&userid=32326
View this thread: http://www.excelforum.com/showthread...hreadid=552126