Moderatori: Anthony47, Flash30005
Sub Consec()
Dim strVP As String, I As Long, J As Long, Ck As String
Dim lDiff As Long, oArr(1 To 15, 1 To 2)
'
strVP = Application.WorksheetFunction.TextJoin("", True, Sheets("generale").Range("K8:K10000"))
For I = 15 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("Squadre").Range("AD7").Resize(15, 2).Value = oArr
End Sub
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
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
For J = 1 To 2
If J = 1 Then Ck = "Vinta" Else Ck = "Persa" '**
lDiff = Len(strVP) - Len(Replace(strVP, StringW(i, Ck), "", , , vbTextCompare)) '**
If lDiff > 0 Then
oArr(i, J) = lDiff / i / Len(Ck) '**
strVP = Replace(strVP, StringW(i, Ck), "###", , , vbTextCompare) '**
End If
Next J
Function StringW(ByVal hMany As Long, ByVal lStr As String) As String
Dim lWk As String, lI As Long
'
For lI = 1 To hMany
lWk = lWk & lStr
Next lI
StringW = lWk
End Function
Torna a Applicazioni Office Windows
Contare occorrenze eliminando i duplicati - Prospetto dati Autore: ricky53 |
Forum: Applicazioni Office Windows Risposte: 10 |
Access 2003: funzione per contare dati Autore: gamma_ray |
Forum: Applicazioni Office Windows Risposte: 1 |
Visitano il forum: Nessuno e 45 ospiti