Hello! I'm new to this Forum and new to VBA. I have a large list of data in multiple columns (columns B to F) and several rows (2 to 20,000). I have highlighted the cells (in Red RGB (255, 0, 0)) that contain 0.00 and I want to hide any rows that do not have a highlighted cell. The below code is what I have but it just hides all the rows. Can someone help me figure out what I have wrong. Thanks!
Private Sub CommandButton1_Click()
Dim active_worksheet As Worksheet
Dim c As Integer
Dim r As Integer
Dim count As Integer
count = 0
For r = 2 To 20000
For c = 2 To 6
If Cells(r, c).Interior.ColorIndex = RGB(255, 0, 0) Then
count = 1
End If
Next c
If count = 0 Then
Rows(r).Hidden = True
End If
count = 0
Next r
End Sub
Bookmarks