简体   繁体   English

Excel VBA-当单元格包含日期时删除行

[英]Excel VBA - Delete rows when a cell contains a date

I am trying to write code that does the following: 我正在尝试编写执行以下操作的代码:

  • Finds Cell A4. 查找单元格A4。
  • If cell contains a date, delete the entire row. 如果单元格包含日期,请删除整行。
  • I want this to loop until the cell in column A does not contain a date. 我希望此循环直到A列中的单元格不包含日期。 Once the cell is blank, the loop can end. 单元格为空后,循环可以结束。

Here's all you need to do this: 这是您要做的所有事情:

  • Using the VBA function IsDate 使用VBA函数IsDate
  • If the value returned is true on the value in Range A4 如果返回的值在Range A4的值为true
  • Delete entire row of Range A4 删除Range A4 entire row
  • If not then your sub is over. 如果没有,则您的子任务结束。

Really it should not be much longer than 5-9 lines of code and it's all very very very simple. 确实,它不应超过5-9行代码,而且非常非常简单。 Come back if you have trouble writing the code and ask a specific question about what you are having trouble with . 如果您在编写代码时遇到问题,请回来, 并提出有关您遇到问题的特定问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM