I want to count cells with blue colour into cell on the other sheet. Sheet with coloured cells is "MAPA" and sheet where is the result is "Skupinka 1" Thank a lot for help!
That's the code
Private Sub Skupinka1_obnov1_Click()
Dim counter As Integer
For counter = 4 To 26
If Worksheets("MAPA").Cells(counter, 1).Interior.ColorIndex = 5 Then
Worksheets("Skupinka 1").Cells(32, 20) = Cells(32, 20) + 1
ElseIf Worksheets("MAPA").Cells(counter, 1).Interior.ColorIndex = 2 Then
Worksheets("Skupinka 1").Cells(32, 20) = 0
' That's for one column, that was working, but when I try it for 2 columns, it was wrong
ElseIf Worksheets("MAPA").Cells(counter, 2).Interior.ColorIndex = 5 Then
Worksheets("Skupinka 1").Cells(32, 20) = Cells(32, 20) + 1
ElseIf Worksheets("MAPA").Cells(counter, 2).Interior.ColorIndex = 2 Then
Worksheets("Skupinka 1").Cells(32, 20) = 0
End If
Next counter
End Sub
'It shows me Subscript out of range. Thanks for answers.
Aucun commentaire:
Enregistrer un commentaire