Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
Ciao Giovanni,
Interpretando la tua domanda in modo diverso da come ha fatto Mauro, e a patto che abbia capito bene io, prova:
'=========>>
Option Explicit
'--------->>
Public Sub DeleteRange()
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range, myRng As Range
Dim rCell As Range
Dim delRng As Range
Dim iLastRow As Long
Dim i As Long
Dim bDelete As Boolean
Dim CalcMode As Long
Const sStr As String = "Infopost-Manager" '<<==== Modifica
Const sFoglio As String = "Foglio1" '<<==== Modifica
Set WB = ThisWorkbook
Set SH = WB.Sheets(sFoglio)
With SH
iLastRow = LastRow(SH, .Columns("A:A"))
Set Rng = .Range("A2:A" & iLastRow)
End With
For i = 1 To Rng.Cells.Count
Set rCell = Rng.Cells(i)
With rCell
If CBool(InStr(1, .Value, sStr)) Then
Set myRng = .Offset(-1).Resize(11)
If bDelete Then
If delRng Is Nothing Then
Set delRng = myRng
Else
Set delRng = Union(myRng, delRng)
End If
i = i + 11
End If
bDelete = True
End If
End With
Next i
On Error GoTo XIT
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
If Not delRng Is Nothing Then
delRng.EntireRow.Delete
Else
'\ Niente trovato!
End If
XIT:
With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With
End Sub
'--------->>
Function LastRow(SH As Worksheet, _
Optional Rng As Range)
If Rng Is Nothing Then
Set Rng = SH.Cells
End If
On Error Resume Next
LastRow = Rng.Find(What:="*", _
After:=Rng.Cells(1), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function
'<<=========
===
Regards,
Norman