LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Looping down a Range to delete entire row


I did this loop and changed the color of the active cell,
now i want to delete the row of the active cell when matched up.


Code
-------------------

Public Sub DeleteRegions()

Dim anyRegion As String, myRegion As String
Dim anyRange As Range
Dim anyCell As Range
Dim iCnt As Long
Dim iCount As Long

anyRegion = Sheet3.KeptRegion

Sheets("ESSR").Activate
Range("A18").Select
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Selection.Cells.Interior.ColorIndex = 19

iCnt = 0

For Each anyCell In Selection
If Not IsEmpty(anyCell) Then
iCnt = iCnt + 1
End If
Next

Range("A18").Select


For iCount = 0 To iCnt
Range("A18").Select
ActiveCell.Offset(rowOffset:=iCount).Activate

myRegion = ActiveCell.Value

If myRegion < anyRegion Then
ActiveCell.EntireRow.Delete
End If
Next

End Sub

-------------------


thanks in advance :)

sportsgu

--
sportsgu
-----------------------------------------------------------------------
sportsguy's Profile: http://www.excelforum.com/member.php...fo&userid=2477
View this thread: http://www.excelforum.com/showthread.php?threadid=38339

 
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 an entire row One-Leg Excel Discussion (Misc queries) 13 November 11th 08 08:27 PM
Delete entire row if David T Excel Discussion (Misc queries) 2 December 6th 06 10:14 PM
Delete Entire Row Tony P.[_3_] Excel Programming 3 May 18th 05 09:58 PM
Delete Entire Row If Q John Excel Programming 10 June 9th 04 03:02 PM
Delete Entire Row. Sam Excel Programming 5 December 21st 03 05:56 AM


All times are GMT +1. The time now is 10:02 PM.

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"