Moderatori: Anthony47, Flash30005
Nota: Non dovevi chiamre questo topic "Piccola Aggiunta su macro"
Ho confrontato i due file e ho notato che le colonne da A a P sono identici quindi le due macro "TrovaAgg" e "TrovaSpia" funzionano bene (conferma per questo)
I valori dalla colonna R alla colonna U sono diversi (macro TrovaNS) ma solo perché stai cambiando le specifiche ora, mi confermi?
In colonna S deve essere sempre 0 (zero) come nel file da te inviato?
Inoltre l'immagine inviata non corrisponde ai dati che sono sul file inviato "ComeDovrebbeEssere"
per fare quello che vuoi dovresti inviare il file come è nell'immagine e con ripristino all'estrazione precedente
Sub TrovaNS()
Set Ws2 = Worksheets("Attuali")
UR = Ws2.Range("B" & Rows.Count).End(xlUp).Row
Ws2.Range("R8:U" & UR).ClearContents
MaxR = 0
ContaS = 1
For RR = 8 To UR
RuS1 = Trim(Ws2.Range("B" & RR).Value) & Trim(Ws2.Range("C" & RR).Value)
RuS2 = Trim(Ws2.Range("B" & RR + 1).Value) & Trim(Ws2.Range("C" & RR + 1).Value)
If RuS1 = RuS2 Then
If MaxR = 0 Then
MioMaxR = Ws2.Range("J" & RR).Value
MaxR = 1
End If
MinR = Ws2.Range("J" & RR + 1).Value
ContaS = ContaS + 1
Else
MaxR = 0
If ContaS > 0 Then
Ws2.Range("R" & RR).Value = ContaS
If ContaS > 1 Then
Ws2.Range("S" & RR).Value = MinR
Ws2.Range("T" & RR).Value = MioMaxR
Ws2.Range("U" & RR).Value = MioMaxR - MinR
End If
ContaS = 1
End If
If Ws2.Range("R" & RR).Value > 0 Then Ws2.Range("S" & RR).Value = Ws2.Range("J" & RR).Value
End If
Next RR
End Sub
Sub TrovaAgg()
Set Ws1 = Worksheets("Archivio")
Set Ws2 = Worksheets("Attuali")
AggS = 0
'Ws2.Range("K8:K1000").ClearContents
For CCA = 3 To 48 Step 5
Dim VNA(90) As Integer
RuA = UCase(Trim(Ws1.Cells(1, CCA)))
For NV = 1 To 90
For Onu = 1 To 5
If NV = Ws1.Cells(2, CCA + Onu - 1).Value Then VNA(Onu) = Ws1.Cells(2, CCA + Onu - 1).Value
Next Onu
Next NV
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
For RR1 = 8 To UR1 + 30
Ambo = ""
If UCase(Trim(Ws2.Range("B" & RR1).Value)) = UCase(Trim(RuA)) Then
For NV = 1 To 5
For NP = 1 To 5
If VNA(NV) = Ws2.Cells(RR1, 3 + NP).Value Then
Ambo = Ambo & " - " & VNA(NV)
End If
Next NP
Next NV
End If
If Ws2.Cells(RR1, 12).Value < Ws1.Range("A2").Value And Trim(Trim(Ws2.Cells(RR1, 14).Value)) <> "Sto" Then '<<< ULTIMA STRINGA INSERITA
'If Ws2.Cells(RR1, 12).Value < Ws1.Range("A2").Value And Trim(Ws2.Cells(RR1, 12).Value) = "Att" Then '<<< SOSTITUITA STRINGA - If Ws2.Cells(RR1, 12).Value < Ws1.Range("A2").Value Then
AggS = 1
DiffRit = Ws1.Range("A2").Value - Ws2.Cells(RR1, 9).Value
RuA2 = UCase(Trim(Ws2.Range("B" & RR1).Value))
If RuA = RuA2 Then
If Len(Ws2.Cells(RR1, 11).Value) < 5 Then
If Len(Ambo) > 5 Then
Ws2.Cells(RR1, 12).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1, 13).Value = CDate(Ws1.Range("B2").Value)
Ws2.Cells(RR1, 10).Value = DiffRit
Ws2.Cells(RR1, 14).Value = "Sto"
Ws2.Cells(RR1, 11).Value = Trim(Mid(Ambo, 3, Len(Ambo)))
Ws2.Cells(RR1, 16).Value = "Positivo"
Ws2.Cells(RR1, 15).Value = "Ambo"
If Len(Ws2.Cells(RR1, 11).Value) > 8 Then Ws2.Cells(RR1, 15).Value = "Terno"
If Ws2.Range("C" & RR1 + 1).Value <> Ws2.Range("C" & RR1).Value Or Ws2.Range("B" & RR1 + 1).Value <> Ws2.Range("B" & RR1).Value Then
Rows(RR1 + 1 & ":" & RR1 + 1).Insert Shift:=xlDown
Ws2.Range("A" & RR1 & ":P" & RR1).Copy Destination:=Ws2.Range("A" & RR1 + 1)
Application.CutCopyMode = False
Ws2.Range("K" & RR1 + 1).ClearContents
Ws2.Range("I" & RR1 + 1).Value = Ws1.Range("A2").Value
Ws2.Range("L" & RR1 + 1).Value = Ws1.Range("A2").Value
Ws2.Range("M" & RR1 + 1).Value = CDate(Ws1.Range("B2").Value)
Ws2.Range("J" & RR1 + 1).Value = 0 'DiffRit
Ws2.Range("N" & RR1 + 1).Value = "Att"
Ws2.Range("O" & RR1 + 1).ClearContents
Ws2.Range("P" & RR1 + 1).Value = "in corso"
Ws2.Range("R" & RR1 + 1).Value = 1
Ws2.Range("S" & RR1 + 1).Value = 0
End If
Else
Ws2.Cells(RR1, 10).Value = DiffRit
Ws2.Cells(RR1, 12).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1, 13).Value = CDate(Ws1.Range("B2").Value)
End If
End If
End If
End If
Next RR1
Next CCA
If AggS = 1 Then TrovaSpia
TrovaNS
End Sub
Private Sub TrovaSpia()
Set Ws1 = Worksheets("Archivio")
Set Ws2 = Worksheets("Attuali")
For CCA = 48 To 3 Step -5
Dim VNA(5) As Integer
Dim VNC(90) As Integer
RuA = UCase(Trim(Ws1.Cells(1, CCA)))
VNC(1) = Ws1.Cells(2, CCA).Value
VNC(2) = Ws1.Cells(2, CCA + 1).Value
VNC(3) = Ws1.Cells(2, CCA + 2).Value
VNC(4) = Ws1.Cells(2, CCA + 3).Value
VNC(5) = Ws1.Cells(2, CCA + 4).Value
CCV = 0
For NV = 1 To 90
For Onu = 1 To 5
If NV = Ws1.Cells(2, CCA + Onu - 1).Value Then
CCV = CCV + 1
VNA(CCV) = Ws1.Cells(2, CCA + Onu - 1).Value
End If
Next Onu
Next NV
NewR = Ws2.Range("B" & Rows.Count).End(xlUp).Row
For NVR = 5 To 1 Step -1
For RR1 = NewR To 8 Step -1
If UCase(Trim(Ws2.Range("B" & RR1).Value)) = UCase(Trim(RuA)) Then
If VNA(NVR) = Ws2.Cells(RR1, 3).Value And Trim(Ws2.Range("N" & RR1).Value) <> "Sto" Then
Rows(RR1 + 1 & ":" & RR1 + 1).Insert Shift:=xlDown
Ws2.Range("A" & RR1 & ":P" & RR1).Copy Destination:=Ws2.Range("A" & RR1 + 1)
Application.CutCopyMode = False
Ws2.Range("I" & RR1 + 1).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1 + 1, 13).Value = CDate(Ws1.Range("B2").Value)
Ws2.Range("J" & RR1 + 1).Value = 0
NewR = RR1
GoTo SaltaNV
End If
End If
Next RR1
SaltaNV:
Next NVR
Next CCA
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
For RR1 = 8 To UR1
Range("A" & RR1).Value = RR1 - 7
Next RR1
End Sub
Private Sub TrovaNS()
Set Ws2 = Worksheets("Attuali")
UR = Ws2.Range("B" & Rows.Count).End(xlUp).Row
Ws2.Range("R8:U" & UR).ClearContents
MaxR = 0
ContaS = 1
For RR = 8 To UR
RuS1 = Trim(Ws2.Range("B" & RR).Value) & Trim(Ws2.Range("C" & RR).Value)
RuS2 = Trim(Ws2.Range("B" & RR + 1).Value) & Trim(Ws2.Range("C" & RR + 1).Value)
If RuS1 = RuS2 Then
If MaxR = 0 Then
MioMaxR = Ws2.Range("J" & RR).Value
MaxR = 1
End If
MinR = Ws2.Range("J" & RR + 1).Value
ContaS = ContaS + 1
Else
MaxR = 0
If ContaS > 0 Then
Ws2.Range("R" & RR).Value = ContaS
If ContaS > 1 Then
Ws2.Range("S" & RR).Value = MinR
Ws2.Range("T" & RR).Value = MioMaxR
Ws2.Range("U" & RR).Value = MioMaxR - MinR
End If
ContaS = 1
End If
If Ws2.Range("R" & RR).Value > 0 Then Ws2.Range("S" & RR).Value = Ws2.Range("J" & RR).Value
End If
Next RR
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Sub TrovaAgg()
Set Ws1 = Worksheets("Archivio")
Set Ws2 = Worksheets("Attuali")
If Ws1.Range("B2").Value <= Ws2.Range("M1") Then Exit Sub
AggS = 0
'Ws2.Range("K8:K1000").ClearContents
For CCA = 3 To 48 Step 5
Dim VNA(90) As Integer
RuA = UCase(Trim(Ws1.Cells(1, CCA)))
For NV = 1 To 90
For Onu = 1 To 5
If NV = Ws1.Cells(2, CCA + Onu - 1).Value Then VNA(Onu) = Ws1.Cells(2, CCA + Onu - 1).Value
Next Onu
Next NV
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
For RR1 = 8 To UR1 + 30
Ambo = ""
If UCase(Trim(Ws2.Range("B" & RR1).Value)) = UCase(Trim(RuA)) Then
For NV = 1 To 5
For NP = 1 To 5
If VNA(NV) = Ws2.Cells(RR1, 3 + NP).Value Then
Ambo = Ambo & " - " & VNA(NV)
End If
Next NP
Next NV
End If
If Ws2.Cells(RR1, 12).Value < Ws1.Range("A2").Value And Trim(Trim(Ws2.Cells(RR1, 14).Value)) <> "Sto" Then '<<< ULTIMA STRINGA INSERITA
'If Ws2.Cells(RR1, 12).Value < Ws1.Range("A2").Value And Trim(Ws2.Cells(RR1, 12).Value) = "Att" Then '<<< SOSTITUITA STRINGA - If Ws2.Cells(RR1, 12).Value < Ws1.Range("A2").Value Then
AggS = 1
DiffRit = Ws1.Range("A2").Value - Ws2.Cells(RR1, 9).Value
RuA2 = UCase(Trim(Ws2.Range("B" & RR1).Value))
If RuA = RuA2 Then
If Len(Ws2.Cells(RR1, 11).Value) < 5 Then
If Len(Ambo) > 5 Then
Ws2.Cells(RR1, 12).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1, 13).Value = CDate(Ws1.Range("B2").Value)
Ws2.Cells(RR1, 10).Value = DiffRit
Ws2.Cells(RR1, 14).Value = "Sto"
Ws2.Cells(RR1, 11).Value = Trim(Mid(Ambo, 3, Len(Ambo)))
Ws2.Cells(RR1, 16).Value = "Positivo"
Ws2.Cells(RR1, 15).Value = "Ambo"
If Len(Ws2.Cells(RR1, 11).Value) > 8 Then Ws2.Cells(RR1, 15).Value = "Terno"
If Ws2.Range("C" & RR1 + 1).Value <> Ws2.Range("C" & RR1).Value Or Ws2.Range("B" & RR1 + 1).Value <> Ws2.Range("B" & RR1).Value Then
Rows(RR1 + 1 & ":" & RR1 + 1).Insert Shift:=xlDown
Ws2.Range("A" & RR1 & ":P" & RR1).Copy Destination:=Ws2.Range("A" & RR1 + 1)
Application.CutCopyMode = False
Ws2.Range("K" & RR1 + 1).ClearContents
Ws2.Range("I" & RR1 + 1).Value = Ws1.Range("A2").Value
Ws2.Range("L" & RR1 + 1).Value = Ws1.Range("A2").Value
Ws2.Range("M" & RR1 + 1).Value = CDate(Ws1.Range("B2").Value)
Ws2.Range("J" & RR1 + 1).Value = 0 'DiffRit
Ws2.Range("N" & RR1 + 1).Value = "Att"
Ws2.Range("O" & RR1 + 1).ClearContents
Ws2.Range("P" & RR1 + 1).Value = "in corso"
Ws2.Range("R" & RR1 + 1).Value = 1
Ws2.Range("S" & RR1 + 1).Value = 0
End If
Else
Ws2.Cells(RR1, 10).Value = DiffRit
Ws2.Cells(RR1, 12).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1, 13).Value = CDate(Ws1.Range("B2").Value)
End If
End If
End If
End If
Next RR1
Next CCA
If AggS = 1 Then TrovaSpia
TrovaNS
Ws2.Range("M1") = Ws1.Range("B2").Value
End Sub
Private Sub TrovaSpia()
Set Ws1 = Worksheets("Archivio")
Set Ws2 = Worksheets("Attuali")
For CCA = 48 To 3 Step -5
Dim VNA(5) As Integer
Dim VNC(90) As Integer
RuA = UCase(Trim(Ws1.Cells(1, CCA)))
VNC(1) = Ws1.Cells(2, CCA).Value
VNC(2) = Ws1.Cells(2, CCA + 1).Value
VNC(3) = Ws1.Cells(2, CCA + 2).Value
VNC(4) = Ws1.Cells(2, CCA + 3).Value
VNC(5) = Ws1.Cells(2, CCA + 4).Value
CCV = 0
For NV = 1 To 90
For Onu = 1 To 5
If NV = Ws1.Cells(2, CCA + Onu - 1).Value Then
CCV = CCV + 1
VNA(CCV) = Ws1.Cells(2, CCA + Onu - 1).Value
End If
Next Onu
Next NV
NewR = Ws2.Range("B" & Rows.Count).End(xlUp).Row
For NVR = 5 To 1 Step -1
For RR1 = NewR To 8 Step -1
If UCase(Trim(Ws2.Range("B" & RR1).Value)) = UCase(Trim(RuA)) Then
If VNA(NVR) = Ws2.Cells(RR1, 3).Value And Trim(Ws2.Range("N" & RR1).Value) <> "Sto" Then
Rows(RR1 + 1 & ":" & RR1 + 1).Insert Shift:=xlDown
Ws2.Range("A" & RR1 & ":P" & RR1).Copy Destination:=Ws2.Range("A" & RR1 + 1)
Application.CutCopyMode = False
Ws2.Range("I" & RR1 + 1).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1 + 1, 13).Value = CDate(Ws1.Range("B2").Value)
Ws2.Range("J" & RR1 + 1).Value = 0
NewR = RR1
GoTo SaltaNV
End If
End If
Next RR1
SaltaNV:
Next NVR
Next CCA
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
For RR1 = 8 To UR1
Range("A" & RR1).Value = RR1 - 7
Next RR1
End Sub
Private Sub TrovaNS()
Set Ws2 = Worksheets("Attuali")
UR = Ws2.Range("B" & Rows.Count).End(xlUp).Row
Ws2.Range("R8:U" & UR).ClearContents
MaxR = 0
ContaS = 1
For RR = 8 To UR
RuS1 = Trim(Ws2.Range("B" & RR).Value) & Trim(Ws2.Range("C" & RR).Value)
RuS2 = Trim(Ws2.Range("B" & RR + 1).Value) & Trim(Ws2.Range("C" & RR + 1).Value)
If RuS1 = RuS2 Then
If MaxR = 0 Then
MioMaxR = Ws2.Range("J" & RR).Value
MaxR = 1
End If
MinR = Ws2.Range("J" & RR + 1).Value
ContaS = ContaS + 1
Else
MaxR = 0
If ContaS > 0 Then
Ws2.Range("R" & RR).Value = ContaS
If Trim(Ws2.Range("N" & RR - 1).Value) = "Sto" Then Ws2.Range("R" & RR).Value = 1
If ContaS > 1 Then
Ws2.Range("S" & RR).Value = MinR
Ws2.Range("T" & RR).Value = MioMaxR
Ws2.Range("U" & RR).Value = MioMaxR - MinR
End If
ContaS = 1
End If
If Ws2.Range("R" & RR).Value > 0 Then Ws2.Range("S" & RR).Value = Ws2.Range("J" & RR).Value
End If
Next RR
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Sub TrovaAgg()
Set Ws1 = Worksheets("Archivio")
Set Ws2 = Worksheets("Attuali")
MaxC = Evaluate("=Max(L:L)")
If Ws2.Range("I1").Value <= MaxC Then Exit Sub
AggS = 0
'Ws2.Range("K8:K1000").ClearContents
For CCA = 3 To 48 Step 5
Dim VNA(90) As Integer
RuA = UCase(Trim(Ws1.Cells(1, CCA)))
For NV = 1 To 90
For Onu = 1 To 5
If NV = Ws1.Cells(2, CCA + Onu - 1).Value Then VNA(Onu) = Ws1.Cells(2, CCA + Onu - 1).Value
Next Onu
Next NV
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
For RR1 = 8 To UR1 + 30
Ambo = ""
If UCase(Trim(Ws2.Range("B" & RR1).Value)) = UCase(Trim(RuA)) Then
For NV = 1 To 5
For NP = 1 To 5
If VNA(NV) = Ws2.Cells(RR1, 3 + NP).Value Then
Ambo = Ambo & " - " & VNA(NV)
End If
Next NP
Next NV
End If
If Ws2.Cells(RR1, 12).Value < Ws1.Range("A2").Value And Trim(Trim(Ws2.Cells(RR1, 14).Value)) <> "Sto" Then '<<< ULTIMA STRINGA INSERITA
'If Ws2.Cells(RR1, 12).Value < Ws1.Range("A2").Value And Trim(Ws2.Cells(RR1, 12).Value) = "Att" Then '<<< SOSTITUITA STRINGA - If Ws2.Cells(RR1, 12).Value < Ws1.Range("A2").Value Then
AggS = 1
DiffRit = Ws1.Range("A2").Value - Ws2.Cells(RR1, 9).Value
RuA2 = UCase(Trim(Ws2.Range("B" & RR1).Value))
If RuA = RuA2 Then
If Len(Ws2.Cells(RR1, 11).Value) < 5 Then
If Len(Ambo) > 5 Then
Ws2.Cells(RR1, 12).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1, 13).Value = CDate(Ws1.Range("B2").Value)
Ws2.Cells(RR1, 10).Value = DiffRit
Ws2.Cells(RR1, 14).Value = "Sto"
Ws2.Cells(RR1, 11).Value = Trim(Mid(Ambo, 3, Len(Ambo)))
Ws2.Cells(RR1, 16).Value = "Positivo"
Ws2.Cells(RR1, 15).Value = "Ambo"
If Len(Ws2.Cells(RR1, 11).Value) > 8 Then Ws2.Cells(RR1, 15).Value = "Terno"
If Ws2.Range("C" & RR1 + 1).Value <> Ws2.Range("C" & RR1).Value Or Ws2.Range("B" & RR1 + 1).Value <> Ws2.Range("B" & RR1).Value Then
Rows(RR1 + 1 & ":" & RR1 + 1).Insert Shift:=xlDown
Ws2.Range("A" & RR1 & ":P" & RR1).Copy Destination:=Ws2.Range("A" & RR1 + 1)
Application.CutCopyMode = False
Ws2.Range("K" & RR1 + 1).ClearContents
Ws2.Range("I" & RR1 + 1).Value = Ws1.Range("A2").Value
Ws2.Range("L" & RR1 + 1).Value = Ws1.Range("A2").Value
Ws2.Range("M" & RR1 + 1).Value = CDate(Ws1.Range("B2").Value)
Ws2.Range("J" & RR1 + 1).Value = 0 'DiffRit
Ws2.Range("N" & RR1 + 1).Value = "Att"
Ws2.Range("O" & RR1 + 1).ClearContents
Ws2.Range("P" & RR1 + 1).Value = "in corso"
Ws2.Range("R" & RR1 + 1).Value = 1
Ws2.Range("S" & RR1 + 1).Value = 0
End If
Else
Ws2.Cells(RR1, 10).Value = DiffRit
Ws2.Cells(RR1, 12).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1, 13).Value = CDate(Ws1.Range("B2").Value)
End If
End If
End If
End If
Next RR1
Next CCA
If AggS = 1 Then TrovaSpia
TrovaNS
' Ws2.Range("M1") = Ws1.Range("B2").Value
End Sub
Private Sub TrovaSpia()
Set Ws1 = Worksheets("Archivio")
Set Ws2 = Worksheets("Attuali")
For CCA = 48 To 3 Step -5
Dim VNA(5) As Integer
Dim VNC(90) As Integer
RuA = UCase(Trim(Ws1.Cells(1, CCA)))
VNC(1) = Ws1.Cells(2, CCA).Value
VNC(2) = Ws1.Cells(2, CCA + 1).Value
VNC(3) = Ws1.Cells(2, CCA + 2).Value
VNC(4) = Ws1.Cells(2, CCA + 3).Value
VNC(5) = Ws1.Cells(2, CCA + 4).Value
CCV = 0
For NV = 1 To 90
For Onu = 1 To 5
If NV = Ws1.Cells(2, CCA + Onu - 1).Value Then
CCV = CCV + 1
VNA(CCV) = Ws1.Cells(2, CCA + Onu - 1).Value
End If
Next Onu
Next NV
NewR = Ws2.Range("B" & Rows.Count).End(xlUp).Row
For NVR = 5 To 1 Step -1
For RR1 = NewR To 8 Step -1
If UCase(Trim(Ws2.Range("B" & RR1).Value)) = UCase(Trim(RuA)) Then
If VNA(NVR) = Ws2.Cells(RR1, 3).Value And Trim(Ws2.Range("N" & RR1).Value) <> "Sto" Then
Rows(RR1 + 1 & ":" & RR1 + 1).Insert Shift:=xlDown
Ws2.Range("A" & RR1 & ":P" & RR1).Copy Destination:=Ws2.Range("A" & RR1 + 1)
Application.CutCopyMode = False
Ws2.Range("I" & RR1 + 1).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1 + 1, 13).Value = CDate(Ws1.Range("B2").Value)
Ws2.Range("J" & RR1 + 1).Value = 0
NewR = RR1
GoTo SaltaNV
End If
End If
Next RR1
SaltaNV:
Next NVR
Next CCA
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
For RR1 = 8 To UR1
Range("A" & RR1).Value = RR1 - 7
Next RR1
End Sub
Private Sub TrovaNS()
Set Ws2 = Worksheets("Attuali")
UR = Ws2.Range("B" & Rows.Count).End(xlUp).Row
Ws2.Range("R8:U" & UR).ClearContents
MaxR = 0
ContaS = 1
For RR = 8 To UR
RuS1 = Trim(Ws2.Range("B" & RR).Value) & Trim(Ws2.Range("C" & RR).Value)
RuS2 = Trim(Ws2.Range("B" & RR + 1).Value) & Trim(Ws2.Range("C" & RR + 1).Value)
If RuS1 = RuS2 Then
If MaxR = 0 Then
MioMaxR = Ws2.Range("J" & RR).Value
MaxR = 1
End If
'MinR = Ws2.Range("J" & RR + 1).Value
If Ws2.Range("J" & RR + 1) <> 0 Then MinR = Ws2.Range("J" & RR + 1).Value
ContaS = ContaS + 1
Else
MaxR = 0
If ContaS > 0 Then
Ws2.Range("R" & RR).Value = ContaS
If Trim(Ws2.Range("N" & RR - 1).Value) = "Sto" Then
Ws2.Range("R" & RR).Value = 1
Ws2.Range("R" & RR - 1).Value = ContaS - 1
Ws2.Range("S" & RR - 1).Value = MinR
Ws2.Range("T" & RR - 1).Value = MioMaxR
Ws2.Range("U" & RR - 1).Value = MioMaxR - MinR
Else
If ContaS > 1 Then
Ws2.Range("S" & RR).Value = MinR
Ws2.Range("T" & RR).Value = MioMaxR
Ws2.Range("U" & RR).Value = MioMaxR - MinR
End If
End If
ContaS = 1
End If
If Ws2.Range("R" & RR).Value > 0 Then Ws2.Range("S" & RR).Value = Ws2.Range("J" & RR).Value
End If
Next RR
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Torna a Applicazioni Office Windows
Macro per aprire file salvato su sharepoint Onedrive Autore: marcopont |
Forum: Applicazioni Office Windows Risposte: 2 |
Come interrompere macro sndPlaySound Autore: systemcrack |
Forum: Applicazioni Office Windows Risposte: 2 |
Macro per aggiungere testo in tutti i files di una cartella? Autore: systemcrack |
Forum: Applicazioni Office Windows Risposte: 15 |
Screenshot automatizzato fogli excel:script?macro o...? Autore: Paolo67met |
Forum: Programmazione Risposte: 9 |
Visitano il forum: Nessuno e 11 ospiti