Hi All
I need assistance with an error message for the below code:
Private Sub CommandButton58_Click()
For intCount = ListBox1.ListCount - 1 To 0 Step -1
If ListBox1.Selected(intCount) Then ListBox1.RemoveItem (intCount)
Next intCount
Dim LR As Long, WasFiltered As Boolean, Foundit As Boolean
Dim vRow As Variant
Dim vSht As Worksheet, tSht As Worksheet
Set vSht = Sheets(UserForm1.TextBox6.Value)
Set tSht = ThisWorkbook.Sheets("Temp")
vRow = ListBox1.ListCount + 5
With tSht
WasFiltered = .AutoFilterMode
If WasFiltered Then .ShowAllData
.Rows(1).AutoFilter 2, vSht.Range("B2").Value
.Rows(1).AutoFilter 4, vSht.Range("A" & vRow).Value
.Rows(1).AutoFilter 5, vSht.Range("B" & vRow).Value
LR = .Range("A" & .Rows.Count).End(xlUp).Row
If LR > 2 Then
Foundit = True
.Range("A2:A" & LR).SpecialCells(xlVisible).EntireRow.Delete xlShiftUp
End If
If WasFiltered Then .ShowAllData Else .AutoFilterMode = False
End With
With vSht
vSht.Rows(vRow).EntireRow.Delete
End With
End Sub
Message appears for below line of code:
Bookmarks