在隐藏模式下过滤Excel行(VB代码)
我想在Excel中过滤大量行,并在Excel中无需运行filter的情况下复制它们的值,仅在VB代码中没有在Excel中进行可视化操作。 这个过程很慢,我想要一个更灵活的select:
' xlSheet.Range("A1:Z100000").AutoFilter(1, "Criteria", , , False) xlSheet.Range("C1:F100000").Copy() xlSheet2.Range("A1").PasteSpecial(Paste:=XlPasteType.xlPasteValues, Operation:=XlPasteSpecialOperation.xlPasteSpecialOperationNone, SkipBlanks:=False, Transpose:=False) Application.CutCopyMode = CType(False, XlCutCopyMode) xlSheet.Range("A1:Z100000").AutoFilter(False) '
有什么build议么? 谢谢 !
我想就这个问题提出这个代码,
Sub Exception_Review()
Application.ScreenUpdating = False Dim FilterCriteria Dim CurrentsheetName As String Dim NewFileName As String'获取当前工作表的名称CurrentsheetName = ActiveSheet.Name范围(“A2:K25”)selectSelection.AutoFilter Selection.AutoFilter字段:= 13,Criteria1:= “No”Selection.SpecialCells(xlCellTypeVisible).Select Selection.Copy Worksheets.Add ActiveSheet.Name =“ExceptionReview”Range(“A1”)。Select ActiveSheet.Paste Application.CutCopyMode = False Cells.Select Selection.Columns.AutoFit Range “A1”)。select(CurrentsheetName)。激活Selection.AutoFilter字段:= 1 Selection.AutoFilter
Range(“A1”)。selectApplication.ScreenUpdating = True End Sub