求助,Excel的VBA改写,如何将某表格名,改为只对当前表格有效,vba已经写好了,谢谢
把vba对表格名为:每天【排名】,改为对当前表格有效Sub宏1()''宏1宏''ActiveWorkbook.Worksheets("每天【排名】").AutoFilte...
把vba对表格名为:每天【排名】,改为对当前表格有效
Sub 宏1()
'
' 宏1 宏
'
'
ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort.SortFields.Add Key:= _
Range("H1:H77684"), SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort.SortFields.Add Key:= _
Range("A1:A77684"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("L3").Select
End Sub 展开
Sub 宏1()
'
' 宏1 宏
'
'
ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort.SortFields.Add Key:= _
Range("H1:H77684"), SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort.SortFields.Add Key:= _
Range("A1:A77684"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("每天【排名】").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("L3").Select
End Sub 展开
展开全部
将代码中的ActiveWorkbook.Worksheets("每天【排名】")这一串,全部换成activesheet
追问
ActiveWorkbook.Worksheets(1).AutoFilter.Sort.SortFields.Clear
这样改也可以吧?这么改是什么意思?你那样改代表什么意思?
追答
ActiveWorkbook.Worksheets(1)----------------指的是活动工作簿中的第一个工作表
activesheet指定的当前工作表
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询