在filter - vba中选择两列

时间:2013-09-01 22:26:04

标签: excel-vba vba excel

我有过滤表格的代码,从16241列的第一个可见行开始,然后选择向下直到单元格为空,但我无法用第一列选择第二列。

请帮我解决这个问题,我正在尝试学习excel中的VBA

Sub PasteSpecial()

    Range("K5:L10000").Select
    Selection.ClearContents
    Selection.Borders.LineStyle = xlNone
    Range("K4").Select
    Sheets("Databeta").Visible = True
    Sheets("Databeta").Select
    Range("WZQ3").Select
    Selection.AutoFilter Field:=1, Criteria1:="<>-"

    With ActiveSheet.AutoFilter.Range

        fRow = .Offset(1).Resize(.Rows.Count - 1, _
                                 .Columns.Count) _
                         .SpecialCells(xlCellTypeVisible).Row

    End With
    'unable to select both column

    Cells(fRow, 16241).Select

    Range(Selection, Selection.End(xlDown)).Copy
    Sheets("Variation").Select
    Range("K5").Select
    Selection.PasteSpecial Paste:=xlPasteValues
    Selection.PasteSpecial Paste:=xlPasteFormats
    Sheets("Databeta").Select
    Application.CutCopyMode = False
    ActiveSheet.ShowAllData
    Sheets("Databeta").Visible = xlVeryHidden
    Sheets("Variation").Select
    Range("D4").Select

End Sub

0 个答案:

没有答案