- Codice: Seleziona tutto
Set wsa = Sheets(Sheets(nfg).Name) ' per rimanere sul foglio intanto che carica i dati nei vari fogli
With wsa
For A = 10 To 2 Step -1
If .Cells(A, "E").Value <> "" And .Cells(A, "E").Value > .Range("L1").Value Then
.Range("D" & A & ":H" & A).Copy 'brutto codice a vedersi
.Range("K1:O1").Insert Shift:=xlDown
' .Range("K1:O1").Value = .Range("D" & A & ":H" & A).Copy 'brutto codice a vedersi
End If
If .Cells(A, "D").Value <> "" Then
myHero = .Cells(A, "D").Value
Call A02_UTENTI(myHero)
End If
Next A
End With
La macro che richiama contiente altro with end with
- Codice: Seleziona tutto
Sub A02_UTENTI(myHero) ' elenca gli utenti e da quando sono iscritti
Dim IE2 As Object
Set ut = Worksheets("Utenti")
With ut
' saltato righe del codice troppo lungo
For Each myVar In TagColl
If myVar.innertext <> "" Or MyFound Then
Split0 = Split(myVar.innertext, Chr(10))
.Cells(Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).Row, "A").Value = Trim(myHero)
.Cells(Cells(Rows.Count, "A").End(xlUp).Offset(0, 1).Row, "B").Value = Mid(Split0(1), 1, InStr(1, Split0(1), ".")) ' nome utente
.Range("C:C").NumberFormat = "dd/mm/yyyy"
.Cells(Cells(Rows.Count, "A").End(xlUp).Offset(0, 2).Row, "C").Value = CDate(Mid(Split0(2), 14, 10)) ' iscritto dal...
Exit For
Else
MyFound = True
End If
Next myVar
On Error GoTo 0
IE2.Quit
Set IE2 = Nothing
End If
End With
End Sub
Volevo sapere se in questo caso il 2° with viene accettato o tiene quello precedente ? e quando la macro torna alla macro precedente mantiene l'ultimo with ? Spero di essere stato abbastanza chiaro altrimenti istruitemi sul with annidato e con richiamo e ritorno ad altra macro