ciao
questa macro funziona
- Codice: Seleziona tutto
Sub ConsecFlex()
Dim strVP As String, i As Long, J As Long, Ck As String
Dim lDiff As Long, oArr()
'------------------
' serve compilare tabella consecutivita fgl Tabelle
' pc - facile gennaio 23
' http://www.pc-facile.com/forum/viewtopic.php?f=26&t=112784&p=663028#p663028
'----------------------
Worksheets("Tabelle").Unprotect ' togli protez
maxx = Application.WorksheetFunction.Max(Sheets("Tabelle").Range("AC:AC"))
ReDim oArr(1 To maxx, 1 To 2)
strVP = Application.WorksheetFunction.TextJoin("", True, Sheets("generale").Range("K8:K10000"))
For i = maxx To 1 Step -1
For J = 1 To 2
If J = 1 Then Ck = "V" Else Ck = "P"
lDiff = Len(strVP) - Len(Replace(strVP, String(i, Ck), "", , , vbTextCompare))
If lDiff > 0 Then
oArr(i, J) = lDiff / i
strVP = Replace(strVP, String(i, Ck), "###", , , vbTextCompare)
End If
Next J
Next i
Sheets("Tabelle").Range("AD7").Resize(maxx, 2).Value = oArr
'-------coloro riga si no --------------------------------
For Z = 7 To Cells(Rows.Count, "AC").End(xlUp).Row ' 7 1ma riga
Range("AC7:AE1000").Interior.ColorIndex = 2 '<<< sfondo bianco
Range("AC7:AE1000").Font.Bold = False
Next Z
For RR = 7 To Z Step 2
Range("AC" & RR & ":AE" & RR).Interior.ColorIndex = 8 ' azzurro chiaro
Range("AC" & RR & ":AE" & RR).Font.Bold = True
Next RR
' -- blocca proteggi foglio----------------------------
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingColumns:=True, AllowFormattingRows:=True
End Sub
ora dovrei fare gli stessi conteggi
con gli stessi riferimenti e nome fogli
MA
anzicche cercare e contare le lettere V _ P
deve cercare contare la frase Vinta _ Persa
ho provato a modivicare V=Vinta e P=Persa
ma non fa i conteggi corretti
ciao
S.O. win10, Excell 2019