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
答案 0 :(得分:1)
完成您要做的事情的一个简单示例是:
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