Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88054

Code that counts cell with green background value = 0

$
0
0

can someone tech how to make a codes that counts cell with green background and has a value of 0?

here's my code

Public Sub FormattingCells()
Dim lastRow As Long, i As Long
Dim total As Integer
lastRow = 5

For i = 2 To lastRow
    Range("B6:B6").Value = 0 + Val(Cells(i, 2).Interior.ColorIndex = 4 And Cells(i, 2).Value < 1)
Next
Range("B6").Value = total
End Sub

Viewing all articles
Browse latest Browse all 88054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>