|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Private Sub CommandButton1_Click()
Range("B1", "B8").Select
Selection.Delete Shift:=xlUp
Range("C1", "C16").Select
Selection.Delete Shift:=xlUp
Range("D1", "D24").Select
Selection.Delete Shift:=xlUp
Range("E1", "E32").Select
Selection.Delete Shift:=xlUp
Range("F1", "F40").Select
Selection.Delete Shift:=xlUp
Range("G1", "G48").Select
Selection.Delete Shift:=xlUp
Range("H1", "H56").Select
Selection.Delete Shift:=xlUp
Range("I1", "I64").Select
Selection.Delete Shift:=xlUp
Range("J1", "J72").Select
Selection.Delete Shift:=xlUp
Range("K1", "K80").Select
Selection.Delete Shift:=xlUp
Range("L1", "L88").Select
Selection.Delete Shift:=xlUp
Range("M1", "M96").Select
Selection.Delete Shift:=xlUp
Range("N1", "N104").Select
Selection.Delete Shift:=xlUp
Range("O1", "O112").Select
Selection.Delete Shift:=xlUp
Range("P1", "P120").Select
Selection.Delete Shift:=xlUp
Range("Q1", "Q128").Select
Selection.Delete Shift:=xlUp
Range("R1", "R136").Select
Selection.Delete Shift:=xlUp
Range("S1", "S144").Select
Selection.Delete Shift:=xlUp
Range("T1", "T152").Select
Selection.Delete Shift:=xlUp
Range("U1", "U160").Select
Selection.Delete Shift:=xlUp
Range("V1", "V168").Select
Selection.Delete Shift:=xlUp
Range("W1", "W176").Select
Selection.Delete Shift:=xlUp
Range("X1", "X184").Select
Selection.Delete Shift:=xlUp
Range("Y1", "Y192").Select
Selection.Delete Shift:=xlUp
Range("Z1", "Z200").Select
Selection.Delete Shift:=xlUp
End Sub
我自己是这样写的请老师们帮忙指正。
Private Sub CommandButton2_Click()
Dim i As Integer, n As Integer, a As Range, b As Range
For i = 2 To 26
For n = 8 To 200
Range(Cells(1, i), Cells(n, i)).Select
Selection.Delete Shift:=xlUp
i = i + 1
n = n + 8
Next
Next
End Sub
|
|