title: hide column based on cell font color in a row vba
body: <p>I am trying to hide columns based on cell font color in first row. Here I want to hide columns if cells in first row has black as font color. Now, I dont want to define a range since my data varies each week so I can have 10 columns this week and 20 next week, and I would like to keep my codes dynamic.</p>
  
  <p>It looks like my vba codes went through (by pressing <strong>F8</strong>) without any issues but nothing happens. I also posted a sample below along with the desire result.</p>
  
  <pre><code> Sub test()
   Dim i As Range
  
    For Each i In Rows(1)
         If i.Font.Color = RGB(0, 0, 0) Then
           i.EntireColumn.Hidden = True
              Else
              i.EntireColumn.Hidden = False
  
          End If
  Next i
  
   End Sub
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Ofuri.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ofuri.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/bbGMa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bbGMa.png" alt="enter image description here"></a></p>