HI,
I have a worksheet with a single column (Column A) containing about 50,000 entries. I have tried folowing code (which is not complete yet)... I was about to move forward when I realized that the Dubug.Print statements are giving strange results. Below are only the 1st three lines which the Debug,Print statement has churnd out:
$A$49305 -4142
$A$49306 -4142
$A$49307 -4142
What happended to $A$1, $A$2 and so on?? Also can someone please help me complete the code. The attached image should give you an idea of how my worksheet is setup and below is the code I have so far:
Sub DelNonHighlight()
'
'Delete all rows in which the 1st cell (in Row A) is NOT highlighted
Dim Rng As Range
Dim r1 As Range
Dim irow
Application.ScreenUpdating = False
Set Rng = Worksheets(1).Cells(1, 1)
irow = Worksheets(1).Cells(Rows.Count, 1).End(xlUp).Row
Set Rng = Rng.Resize(irow - Rng.Row + 1, 1)
MsgBox Rng.Address
On Error Resume Next
For Each r1 In Rng
' Here I want to check if the current cell (pointed to by r1) has a yellow highlight. And
' if so, I want to move to the next row, If the Current cell is NOT highlighted, I want to ' delete the row and move on to the next cell
[B][COLOR="Red"] Debug.Print r1.Address & " " & r1.Interior.ColorIndex[/COLOR][/B]Next
Application.ScreenUpdating = True
End Sub
Display More