0
votes

I am trying to write code that does the following:

  • Finds Cell 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. Once the cell is blank, the loop can end.
1
Is the cell in date form already, or could it be a string?brettdj
fwiw there are better ways speed wise to handle this than a For-loop over a range. AutoFilter, inserting a working column formula or using variant arrays are all vastly superior to looping over a range. If you are open to other methods let us knowbrettdj
Who gave this +1 ? There is not even a question in this post. It's just an affirmation that OP wants to do this (and did not try to do it or does not care to show his work).ApplePie
@AlexandreP.Levasseur, there is a question. But from the looks of it he hasn't done any research whatsoever and probably has zilch for code.CustomX
@t.thielemans: There is no question here. First clue: look for a question mark. ;)ApplePie

1 Answers

3
votes

Here's all you need to do this:

  • Using the VBA function IsDate
  • If the value returned is true on the value in Range A4
  • Delete entire row of Range A4
  • 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. Come back if you have trouble writing the code and ask a specific question about what you are having trouble with.