怎样使用VBA背景色和拼音单列双条件排序?
1、首先在开发工具中打开VBA编辑器
2、在单元格区域当中输入一些内容作为例子
3、在VBA编辑器中插入模块
4、在模块当中输入如下代码,然后运行Sub 单列双条件排序背景色和拼音() With 钽吟篑瑜ActiveWorkbook.ActiveSheet.Sort .SortFields.Clear .SortFields.Add(Application.Intersect(ActiveCell.EntireColumn, ActiveCell.CurrentRegion),xlSortOnCellColor, xlAscending) .SortOnValue.Color=ActiveCell.Interior.Color '条件一:当前单元格背景色置顶 .SortFields.Add Key:=Application.Intersect(ActiveCell.EntireColumn, ActiveCell.CurrentRegion),SortOn:=xlSortOnValues, Order:=xlAscending .SetRange Application.Intersect(ActiveCell.EntireColumn, ActiveCell.CurrentRegion) .SortMethod=xlPinYin '条件二:中文排序方式为以拼音为基准 .Apply End WithEnd Sub
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:40
阅读量:46
阅读量:50
阅读量:90
阅读量:42