Hi again
With the help of this forum, I created a macro that hides rows. What I want the macro to do is to hide rows from columns 7 to 10 whose cells have a white background (no color) and at the same time the font is black
Below is my code. I do not get an error but nothing happens when I execute the macro. The rows are not hidden at all. What did I do wrong in the macro below?. There is something wrong. The problem is with the the line in red below
If Cells(x, 7).Interior.TintAndShade = 0 And Cells(x, 7).Font.ColorIndex = Automatic And Cells(x, 8).Interior.TintAndShade = 0 And Cells(x, 8).Font.ColorIndex = Automatic _
And Cells(x, 9).Interior.TintAndShade = 0 And Cells(x, 9).Font.ColorIndex = Automatic And Cells(x, 10).Interior.TintAndShade = 0 And Cells(x, 10).Font.ColorIndex = Automatic Then
Cells(x, 7).Interior.TintAndShade = 0 (this code checks to see if the Cell has no color) and Cells(x, 7).Font.ColorIndex = Automatic (this code checks to see if the font is black). But I believe that these 2 lines of code is wrong. So can someone out there give me the correct code? Thanks
Sub Test1()
Application.ScreenUpdating = False
Range("A" & Rows.Count).End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Offset(0, 6).Select
ActiveCell.FormulaR1C1 = "."
Range("G1").Select
Do
x = ActiveCell.Row
If Cells(x, 7).Interior.TintAndShade = 0 And Cells(x, 7).Font.ColorIndex = Automatic And Cells(x, 8).Interior.TintAndShade = 0 And Cells(x, 8).Font.ColorIndex = Automatic _
And Cells(x, 9).Interior.TintAndShade = 0 And Cells(x, 9).Font.ColorIndex = Automatic And Cells(x, 10).Interior.TintAndShade = 0 And Cells(x, 10).Font.ColorIndex = Automatic Then
Rows(x).Hidden = True
End If
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.FormulaR1C1 = "."
End Sub
With the help of this forum, I created a macro that hides rows. What I want the macro to do is to hide rows from columns 7 to 10 whose cells have a white background (no color) and at the same time the font is black
Below is my code. I do not get an error but nothing happens when I execute the macro. The rows are not hidden at all. What did I do wrong in the macro below?. There is something wrong. The problem is with the the line in red below
If Cells(x, 7).Interior.TintAndShade = 0 And Cells(x, 7).Font.ColorIndex = Automatic And Cells(x, 8).Interior.TintAndShade = 0 And Cells(x, 8).Font.ColorIndex = Automatic _
And Cells(x, 9).Interior.TintAndShade = 0 And Cells(x, 9).Font.ColorIndex = Automatic And Cells(x, 10).Interior.TintAndShade = 0 And Cells(x, 10).Font.ColorIndex = Automatic Then
Cells(x, 7).Interior.TintAndShade = 0 (this code checks to see if the Cell has no color) and Cells(x, 7).Font.ColorIndex = Automatic (this code checks to see if the font is black). But I believe that these 2 lines of code is wrong. So can someone out there give me the correct code? Thanks
Sub Test1()
Application.ScreenUpdating = False
Range("A" & Rows.Count).End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Offset(0, 6).Select
ActiveCell.FormulaR1C1 = "."
Range("G1").Select
Do
x = ActiveCell.Row
If Cells(x, 7).Interior.TintAndShade = 0 And Cells(x, 7).Font.ColorIndex = Automatic And Cells(x, 8).Interior.TintAndShade = 0 And Cells(x, 8).Font.ColorIndex = Automatic _
And Cells(x, 9).Interior.TintAndShade = 0 And Cells(x, 9).Font.ColorIndex = Automatic And Cells(x, 10).Interior.TintAndShade = 0 And Cells(x, 10).Font.ColorIndex = Automatic Then
Rows(x).Hidden = True
End If
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.FormulaR1C1 = "."
End Sub