
Sub contavuoti()
Range("c1:c65000") = ""
valore_celle = Range("b" & Rows.Count).End(xlUp).Value
contatore = -1
For i = Range("b" & Rows.Count).End(xlUp).Row To 1 Step -1
val_cella = Cells(i, 2).Value
If val_cella = valore_celle Then
contatore = contatore + 1
Else
If contatore > 0 Then
Cells(i + 1, 3) = contatore
End If
contatore = 0
End If
valore_celle = Cells(i, 1).Value
Next i
If contatore > 1 Then
Cells(i + 1, 3) = contatore
End If
Range("d1").Formula = "=Sum(C1:C65000)" '<< mette il totale delle celle vuote in d1
End Sub |
Sub contavuoti()
Range("j9:am9") = ""
valore_celle = Range("b" & Rows.Count).End(xlUp).Value
contatore = -1
For i = Range("b" & Rows.Count).End(xlUp).Row To 1 Step -1
val_cella = Cells(i, 2).Value
If val_cella = valore_celle Then
contatore = contatore + 1
Else
If contatore > 0 Then
Cells(i + 1, 3) = contatore
End If
contatore = 0
End If
valore_celle = Cells(i, 1).Value
Next i
If contatore > 1 Then
Cells(i + 1, 3) = contatore
End If
Range("ar9").Formula = "=Sum(j9:am9)" '<< mette il totale delle celle vuote in ar9
End Sub |
