0

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.
6
  • Is the cell in date form already, or could it be a string? Commented Nov 18, 2012 at 0:11
  • 1
    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 know Commented Nov 18, 2012 at 0:21
  • 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). Commented Nov 19, 2012 at 12:14
  • @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. Commented Nov 19, 2012 at 12:18
  • @t.thielemans: There is no question here. First clue: look for a question mark. ;) Commented Nov 19, 2012 at 12:20

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Oh I misunderstood, only cell A4 can't contain a date? I thought the entire column A! ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.