Range("C1").FormulaR1C1?=?"=RAND()"'C1单元格填写随机函数
Range("C1").Select'选择C1单元格
Selection.AutoFill?Destination:=Range("C1:C20000")'C1:C20000区域自动填充
Range("C1:C4").Select'选择C1:C4,此句可省
Columns("A:C").Select'选择A:C列,此句可省
ActiveSheet.Sort.SortFields.Clear'清空排序集合
ActiveSheet.Sort.SortFields.Add?Key:=Range("B:B"),?_
SortOn:=xlSortOnValues,?Order:=xlAscending,?DataOption:=xlSortNormal'B列升序
ActiveSheet.Sort.SortFields.Add?Key:=Range("C:C"),?_
SortOn:=xlSortOnValues,?Order:=xlAscending,?DataOption:=xlSortNormal'再C列升序
With?ActiveSheet.Sort'排序
.SetRange?Range("A:C")'区域A:C列
.Header?=?xlGuess'包含标题
.MatchCase?=?False'不区分大小写
.Orientation?=?xlTopToBottom’指定为升序
.SortMethod?=?xlPinYin'按拼音排序
.Apply
End?With