JetSetDrive
New Member
- Joined
- Jul 26, 2019
- Messages
- 14
Can anyone assist me with figuring out why excel is not pulling over the rows that match the search criteria? The message box is showing no values found even though there are matching values. Is it because the value is set to "0"?
Dim lastrow As Long
Dim c As Long
Dim s As Variant
Dim ans As String
ans = ActiveSheet.Name
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "No MinMax"
c = 12
s = "0"
lastrow = Sheets(ans).Cells(Rows.Count, c).End(xlUp).Row
With Sheets(ans).Cells(1, c).Resize(lastrow)
.AutoFilter 1, s
counter = .Columns(c).SpecialCells(xlCellTypeVisible).Count
If counter > 1 Then
.Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).EntireRow.Copy Sheets("No MinMax").Rows(2)
Sheets(ans).Rows(1).Copy Sheets("No MinMax").Rows(1)
Else
MsgBox "No values found"
End If
.AutoFilter
End With
application.ScreenUpdating = True
End Sub
Dim lastrow As Long
Dim c As Long
Dim s As Variant
Dim ans As String
ans = ActiveSheet.Name
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "No MinMax"
c = 12
s = "0"
lastrow = Sheets(ans).Cells(Rows.Count, c).End(xlUp).Row
With Sheets(ans).Cells(1, c).Resize(lastrow)
.AutoFilter 1, s
counter = .Columns(c).SpecialCells(xlCellTypeVisible).Count
If counter > 1 Then
.Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).EntireRow.Copy Sheets("No MinMax").Rows(2)
Sheets(ans).Rows(1).Copy Sheets("No MinMax").Rows(1)
Else
MsgBox "No values found"
End If
.AutoFilter
End With
application.ScreenUpdating = True
End Sub