Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 2406|回复: 5

[已解决]请师父们帮我写个VBA的代码,当E列单元格是空值时,删除整行,在线等谢谢,附件上传

[复制链接]
发表于 2015-1-28 10:16 | 显示全部楼层 |阅读模式
请师父们帮我写个VBA的代码,当E列单元格是空值时,删除整行,在线等谢谢,附件上传
最佳答案
2015-1-28 10:37
  1. Sub Macro1()
  2. On Error Resume Next
  3. n = Cells.Find("*", searchdirection:=xlPrevious).Row
  4. Range("E3:E" & n).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
  5. End Sub
复制代码

当E列单元格是空值时,删除整行.zip

7.5 KB, 下载次数: 20

excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2015-1-28 10:37 | 显示全部楼层    本楼为最佳答案   
  1. Sub Macro1()
  2. On Error Resume Next
  3. n = Cells.Find("*", searchdirection:=xlPrevious).Row
  4. Range("E3:E" & n).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
  5. End Sub
复制代码
回复

使用道具 举报

发表于 2015-1-28 10:38 | 显示全部楼层
本帖最后由 renyz2006 于 2015-1-28 10:48 编辑

Sub Macro1()
    Columns("E:E").Select
    Selection.SpecialCells(xlCellTypeBlanks).Select
    Selection.EntireRow.Delete
End Sub


不知能行否?
回复

使用道具 举报

发表于 2015-1-28 10:45 | 显示全部楼层
Sub Macro1()
    On Error Resume Next
    Range("E3:E" & Rows.Count).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
回复

使用道具 举报

发表于 2015-1-28 10:49 | 显示全部楼层
  1. Sub x()
  2. Dim x As Integer, st As String
  3.   For x = 3 To Cells(Rows.Count, 1).End(3).Row
  4.    If Cells(x, "e") = "" Then
  5.     st = st & "e" & x & ","
  6.    End If
  7. Next
  8.   Range(Left(st, Len(st) - 1)).EntireRow.Delete
  9. End Sub
  10.    
复制代码
回复

使用道具 举报

 楼主| 发表于 2015-1-28 11:21 | 显示全部楼层

超链接,代码不可用

2楼和5楼的师傅代码都可以用,我还想请教个问题,见附件,谢谢

当E列单元格是空值时,删除整行,超链接后,不可用.zip

84.07 KB, 下载次数: 4

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-3-28 21:15 , Processed in 1.354354 second(s), 14 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表