View Single Post
  #7   Report Post  
Old July 6th 19, 06:56 PM posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
First recorded activity by ExcelBanter: Apr 2011
Posts: 3,788
Default Identify rows if in the row one of the cells within a range is colored

Hi Johan,

Am Sat, 6 Jul 2019 09:38:52 -0700 (PDT) schrieb JS SL:

After run the macro all the columns F till BZ are hidden
But... There are only a few cells in the range 'F3 till BZ last row' with a collored cell. The macro hides them all.

Only the columns without any colored cell in one of the rows of that specific column should be set on hide (hide if at least one of the cells in all the used rows has a fill color).

sorry, I misunderstood your question.

Change the lower part of the code in this way:

For j = 78 To 6 Step -1
Counter = 0
For i = 3 To LRow
If .Cells(i, j).Interior.Pattern < xlNone Then
Exit For
Counter = Counter + 1
End If
If Counter = LRow - 2 Then Columns(j).Hidden = True

Claus B.
Office 2016