0

excel vba 的新手,对不起,如果这太明显了......
我在电子表格中得到了这个数据,
如何通过“标题”列过滤掉表格
所以我将能够通过按标题过滤来选择表格的一部分
谢谢

book name       Description                             title
gsod        Samples from US weather since 1929          title1
mlab        Measurement data of performance             title1
natality    Birth States from 1969 to 2008              title2
shakespeare Word index for works of                     title2
wikipedia   Revision information for Wikipedia          title1
4

1 回答 1

2

完成您正在尝试做的事情的一个简单示例是:

Sub SortColumnC()

If Sheets(1).AutoFilterMode = False Then
    Sheets(1).Range("A1:C1").AutoFilter
End If

RowCount = Sheets(1).Range("A" & Rows.Count).End(xlUp).Row
ActiveWorkbook.Worksheets(1).AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets(1).AutoFilter.Sort.SortFields.Add Key:=Range("C2:C" & RowCount), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets(1).AutoFilter.Sort
    .Header = xlYes
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
End With

End Sub
于 2013-10-15T15:18:37.617 回答