S
sportsguy
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![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
sportsgu
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