作者:乔山办公网日期:
返回目录:excel表格制作
录制一个百宏,按住CTRL,选中A列度,D列,F列,然后按删知除.宏录制完了.再把道宏内容看一专下,就知道怎么处理.
如下属:
Range("A:A,D:D,F:F").Select
Selection.Delete Shift:=xlToLeft
1、打开百Excel表格,使用【Alt】+【F11】组合快捷键打开VBA编辑器,也可以点击菜单栏上面的【开发工具】,度【Visual Basic】打开VBA编辑器。
2、在VBA编辑器的菜单栏上面点击【插入知】,【模块】。
3、在VBA编辑器的代码框里面输入以下程序:
sub test11
for j = Cells(Rows.Count, 1).End(xlUp).Row to 1 step -1
if cells(1,j)="列名道" then
columns(j).delete
end if
next
end sub
4、点击VBA编辑器工具栏上面的“运行”图标运行程序,或者按下【F5】键运行程序。
5、然后程序运行完成后,将会回弹出删答除多少行的提示,Excel表格上面满足条件的行已经被删除。
比如删除zd版D列空白的权行
Sub S()
Dim c%, i%
c = Cells(Rows.Count, 4).End(3).Row
For i = c To 1 Step -1
If Cells(i, 4) = "" Then Rows(i).Delete
Next
End Sub
Sub aaa()
Set rn = Nothing
For Each Rng In [E1:AW1]
If Rng > 5 And Rng < 12 Then
If rn Is Nothing Then
Set rn = Rng
Else
Set rn = Union(rn, Rng)
End If
End If
Next Rng
If Not rn Is Nothing Then rn.EntireColumn.Delete
End Sub