|
楼主 |
发表于 2023-4-7 12:04
|
显示全部楼层
根据个别老师的建议,我录制了一个宏,可以实现示范文件的处理。但是不会修改为通用程序。老师们可以帮忙提示下吗?
Sub 宏1()
Range("B2:B13").Select
Selection.Cut
Range("A14").Select
ActiveSheet.Paste
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Range("B2:B13").Select
Selection.Copy
Range("B14").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-24
Columns("A:B").Select
Application.CutCopyMode = False
Selection.Copy
Range("D1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add2 Key:=Range("E2:E25") _
, SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("D1:E25")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("D1:E9").Select
Selection.Copy
Sheets.Add After:=ActiveSheet
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "100"
Range("A1").Select
ActiveSheet.Paste
Range("F10").Select
Sheets("Sheet1").Select
Range("D10").Select
ActiveWindow.SmallScroll Down:=3
Range("D10:E15").Select
Application.CutCopyMode = False
Selection.Copy
Sheets.Add After:=ActiveSheet
ActiveSheet.Paste
Sheets("Sheet3").Select
Sheets("Sheet3").Name = "90"
Range("G17").Select
Sheets("Sheet1").Select
Range("D16").Select
ActiveWindow.SmallScroll Down:=3
Range("D16:E21").Select
Application.CutCopyMode = False
Selection.Copy
Sheets.Add After:=ActiveSheet
ActiveSheet.Paste
Sheets("Sheet4").Select
Sheets("Sheet4").Name = "80"
Range("E15").Select
Sheets("Sheet1").Select
ActiveWindow.SmallScroll Down:=9
Range("D22:E25").Select
Application.CutCopyMode = False
Selection.Copy
Sheets.Add After:=ActiveSheet
ActiveSheet.Paste
Sheets("Sheet5").Select
Sheets("Sheet5").Name = "70"
Range("H17").Select
ActiveWindow.SmallScroll Down:=-12
Sheets("Sheet1").Select
ActiveWindow.SmallScroll Down:=-12
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
End Sub |
|